# Inventory module

## Main methods

- `addItem()`
- `removeItem()`
- `getInventory()`
- `buyItem()`
- `getItem()`
- `useItem()`
- `getAutocompleteItems()`

## Rules

- max slots and max stack size come from runtime config
- removing the last quantity deletes the inventory row
- `buyItem()` uses `economyService.modifyUserBalance()` and `addItem()` in one transaction

## Item usage

- item behavior is driven by `items.usageData`
- items without `usageData.effects` are not usable
- `usageData.consume` controls whether the item is removed after use
- effect execution is routed through `effect.registry.ts`

To add a new effect type, update:

- `shared/lib/constants.ts`
- `effect.types.ts`
- `effect.handlers.ts`
- `effect.registry.ts`

## Notes

- XP boost and temp-role effects are timer-based and overwrite existing timers rather than stacking
- temp-role effects only write timer data; actual Discord role assignment is handled outside this service
- autocomplete only returns usable items
