# Trade module

## Model

- trade sessions are in-memory only
- sessions are keyed by Discord thread ID
- there is no persistence or restart recovery

## Main methods

- `createSession()`
- `getSession()`
- `endSession()`
- `updateMoney()`
- `addItem()`
- `removeItem()`
- `toggleLock()`
- `executeTrade()`
- `clearSessions()`

## Rules

- any change to money or items unlocks both participants
- `executeTrade()` requires both users to be locked
- money transfer goes through `economyService.modifyUserBalance()`
- item transfer goes through `inventoryService.removeItem()` and `addItem()`
- item transfers are also logged in `item_transactions`

## Notes

- `_sessions` is intentionally exposed for tests
- type definitions live under `bot/modules/trade/trade.types.ts`, while the service stays in `shared/modules/trade`
