# StockLevel

## Description

StockLevel tracks the current quantity of a specific item at a specific storage location. It maintains four quantity buckets: on-hand, reserved, incoming, and blocked. The available quantity is derived as on-hand minus reserved minus blocked. Stock levels are updated internally by stock movement execution, reservation operations, and block/unblock operations.

Stock level records persist even when all quantities reach zero — they are never deleted.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- Stock levels are updated internally by stock movement execution, reservation, and block/unblock operations

### Query Definitions

- [getStockLevel](../queries/GetStockLevel.md) - Retrieve the stock level for a specific item at a specific location
- [listStockLevels](../queries/ListStockLevels.md) - List stock levels with optional filters
- [getWarehouseStockSummary](../queries/GetWarehouseStockSummary.md) - Retrieve aggregated stock summary for a warehouse

### Models

- StockLevel

### Invariants

- Unique per item-storageLocation pair
- Available quantity = onHand - reserved - blocked
- Available quantity cannot go negative (reservation or block rejected if it would exceed available)
- Quantities are stored in the item's base unit of measure
- Records persist with zero quantities and are not deleted
- Concurrent movements must produce correct final quantities

### Relationships

- **References Item**: Each stock level references an Item from the item-management module
- **References StorageLocation**: Each stock level belongs to a specific storage location
