# SalesPriceList

## Description

SalesPriceList groups reusable customer-facing price rules for one company. It provides the administrative boundary for activating, retiring, and auditing a commercial pricing set without forcing price logic into the item master itself.

## Domain Model Definitions

### Model type

Stateful

#### State Transitions

```mermaid
stateDiagram-v2
    [*] --> Draft: createSalesPriceList
    Draft --> Active: activateSalesPriceList
    Active --> Inactive: deactivateSalesPriceList
```

| Operation | From | To | Command |
|-----------|------|----|---------|
| activate | DRAFT | ACTIVE | [activateSalesPriceList](../commands/ActivateSalesPriceList.md) |
| deactivate | ACTIVE | INACTIVE | [deactivateSalesPriceList](../commands/DeactivateSalesPriceList.md) |

### Command Definitions

- [createSalesPriceList](../commands/CreateSalesPriceList.md) - Create a draft price list for one company and commercial context.
- [updateSalesPriceList](../commands/UpdateSalesPriceList.md) - Revise list metadata while it remains editable.
- [activateSalesPriceList](../commands/ActivateSalesPriceList.md) - Make the list available for price-rule resolution on new orders.
- [deactivateSalesPriceList](../commands/DeactivateSalesPriceList.md) - Prevent future orders from using the list while preserving history.

### Query Definitions

- [getSalesPriceList](../queries/GetSalesPriceList.md) - Retrieve one price list with its company scope and activation state.
- [listSalesPriceLists](../queries/ListSalesPriceLists.md) - List price lists for pricing administration and audit.
- [listSalesPriceRulesByPriceList](../queries/ListSalesPriceRulesByPriceList.md) - List the rules maintained under a selected price list.

### Models

- SalesPriceList
- SalesPriceRule

### Invariants

- Every price list belongs to exactly one company.
- Only ACTIVE price lists may participate in new price resolution.
- Deactivating a price list never mutates the snapshotted prices already stored on confirmed sales orders or issued invoices.

### Relationships

- **Owns SalesPriceRule**: A price list groups one or more SalesPriceRule records.
- **References Company (cross-module)**: `companyId` scopes the list to a single legal entity.
- **Referenced By SalesOrderLine**: Order lines may store the matched rule that came from a given list at defaulting time.
