# WorkCenter

## Description

WorkCenter represents the machine, line, cell, or labor pool where routing operations are planned and executed. It owns scope, capacity assumptions, calendar reference, standard labor or machine rates, and the optional overhead-absorption rule that manufacturing snapshots onto released orders.

## Domain Model Definitions

### Model type

Stateful

#### State Transitions

```mermaid
stateDiagram-v2
    [*] --> Draft: createWorkCenter
    Draft --> Draft: updateWorkCenter
    Draft --> Active: activateWorkCenter
    Active --> Active: updateWorkCenter
    Active --> Inactive: deactivateWorkCenter
    Inactive --> Active: activateWorkCenter
```

| Operation | From | To | Command |
|-----------|------|----|---------|
| activate | DRAFT, INACTIVE | ACTIVE | [activateWorkCenter](../commands/ActivateWorkCenter.md) |
| deactivate | ACTIVE | INACTIVE | [deactivateWorkCenter](../commands/DeactivateWorkCenter.md) |

### Command Definitions

- [createWorkCenter](../commands/CreateWorkCenter.md) - Create a draft work center with scope, capacity, and rate definitions.
- [updateWorkCenter](../commands/UpdateWorkCenter.md) - Revise mutable master data, capacity assumptions, and overhead policy.
- [activateWorkCenter](../commands/ActivateWorkCenter.md) - Validate readiness and move the work center into executable use.
- [deactivateWorkCenter](../commands/DeactivateWorkCenter.md) - Prevent future routing or execution use while preserving history.

### Query Definitions

- [getWorkCenter](../queries/GetWorkCenter.md) - Retrieve one work center with cost and capacity context.
- [listWorkCentersBySite](../queries/ListWorkCentersBySite.md) - List work centers available at one site or scoped facility.

### Models

- WorkCenter

### Invariants

- Work-center code is unique inside its company and effective site scope.
- Capacity assumptions are always positive and expressed in one consistent planning unit.
- An active work center must have the calendar, status, and cost fields required by release and execution flows.
- Labor and machine rate assumptions are always zero or greater.
- `overheadAbsorptionMethod` may be unset, but when set it must be one of `PERCENT_OF_LABOR_COST`, `PERCENT_OF_MACHINE_COST`, or `FIXED_AMOUNT_PER_GOOD_UNIT`.
- `overheadAbsorptionCurrency` is required whenever the overhead method is `FIXED_AMOUNT_PER_GOOD_UNIT`.
- Changes to work-center rates or overhead rules never mutate cost baselines already snapshotted on released production orders.

### Relationships

- **Belongs To Company and Site**: execution scope is constrained by [Company](../../../organization/docs/models/Company.md) and [Site](../../../organization/docs/models/Site.md).
- **Referenced By Routing**: [Routing](./Routing.md) operations assign work to one work center.
- **Referenced By WorkOrder**: released operation snapshots preserve work-center context on [WorkOrder](./WorkOrder.md).
- **Feeds ManufacturingCostSummary**: labor, machine, and overhead assumptions roll into [ManufacturingCostSummary](./ManufacturingCostSummary.md).
