# UoMCategory

## Description

UoMCategory organizes units of measure into logical groupings where conversions are meaningful. Each category has a designated reference unit that serves as the base for all conversion calculations within that category. Units can only be converted to other units within the same category.

Examples: Unit, Weight, Volume, Length, Time.

## Domain Model Definitions

### Model type

Stateful

#### State Transitions

```mermaid
stateDiagram-v2
    [*] --> Active: create
    Active --> Inactive: deactivate
    Inactive --> Active: activate
```

| Operation | From | To | Command |
|-----------|------|----|---------|
| deactivate | ACTIVE | INACTIVE | [deactivateCategory](../command/DeactivateCategory.md) |
| activate | INACTIVE | ACTIVE | [activateCategory](../command/ActivateCategory.md) |

### Command Definitions

- [createCategory](../command/CreateCategory.md)
- [activateCategory](../command/ActivateCategory.md)
- [deactivateCategory](../command/DeactivateCategory.md)
- [setReferenceUnit](../command/SetReferenceUnit.md)

### Query Definitions

### Models

- UoMCategory

### Invariants

- Category name must be unique
- Reference unit must belong to this category
- Category cannot be deactivated while it has active units

### Relationships

- **Has Many Units**: A category contains multiple units (one-to-many)
- **Has One Reference Unit**: Each category designates one unit as the reference unit for conversions
