# CostVarianceLine

## Description

CostVarianceLine stores one classified variance entry within a ManufacturingCostSummary. It owns the variance type, computed amount, optional account reference for settlement handoff, and an optional variance percentage that together express the planned-versus-actual deviation for one cost category.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [technicallyCompleteProductionOrder](../command/TechnicallyCompleteProductionOrder.md) - Move the parent summary toward variance review where variance lines are produced.
- [reviewManufacturingCostSummary](../command/ReviewManufacturingCostSummary.md) - Recalculate, classify, and freeze variance lines on the parent summary.

### Query Definitions

- [getManufacturingCostSummary](../query/GetManufacturingCostSummary.md) - Retrieve variance lines as part of the parent manufacturing cost summary.
- [listManufacturingCostSummariesByStatus](../query/ListManufacturingCostSummariesByStatus.md) - List summaries whose variance lines await review or settlement.

### Models

- CostVarianceLine

### Invariants

- Every CostVarianceLine belongs to exactly one ManufacturingCostSummary.
- `varianceType` must be one of `MATERIAL_PRICE`, `MATERIAL_USAGE`, `LABOR_RATE`, `LABOR_EFFICIENCY`, `MACHINE_RATE`, `MACHINE_EFFICIENCY`, `SCRAP`, or `YIELD`.
- Variance lines are frozen when the parent summary reaches `VARIANCE_REVIEWED`.
- Each named variance type appears at most once per summary.

### Relationships

- **Belongs To ManufacturingCostSummary**: each line is subordinate to one [ManufacturingCostSummary](./ManufacturingCostSummary.md).
