# Unit

## Description

Unit defines an individual unit of measure with its symbol, display name, and conversion factor relative to its category's reference unit. Units support configurable rounding precision for business operations.

Examples: kg (kilogram), lb (pound), ea (each), dz (dozen).

## Domain Model Definitions

### Model type

Stateful

#### State Transitions

```mermaid
stateDiagram-v2
    [*] --> Active: create
    Active --> Inactive: deactivate
    Inactive --> Active: activate
    note right of Active: Reference unit cannot be deactivated
```

### Command Definitions

- [createUnit](../commands/CreateUnit.md)
- [activateUnit](../commands/ActivateUnit.md)
- [deactivateUnit](../commands/DeactivateUnit.md)

### Query Definitions

- [convertQuantity](../queries/ConvertQuantity.md)

### Models

- Unit

### Invariants

- Conversion factor must be a positive value
- Reference unit has conversion factor of 1.0
- Symbol must be unique within the category
- Reference unit cannot be deactivated

### Relationships

- **Belongs To Category**: Each unit belongs to exactly one UoMCategory
- **May Be Reference Unit**: A unit may be designated as its category's reference unit
