# PlanVersion

## Description

PlanVersion is a versioning entity that supports multi-version budget planning, enabling organizations to maintain an approved operating budget alongside rolling forecasts and what-if simulations. Each plan version carries a name, type (BUDGET, FORECAST, or SIMULATION), optional base version reference for copying line items, and company scope. The BUDGET type represents the committed baseline, FORECAST enables rolling adjustments to projections, and SIMULATION allows what-if modeling without altering any committed plan. Plan versions can reference a base version from which line items are copied, supporting incremental planning workflows.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- [createPlanVersion](../commands/CreatePlanVersion.md) - Create a new plan version with name, type, optional base version reference, and company

### Query Definitions

- None — plan versions are accessed through their associated budget queries

### Models

- PlanVersion

### Invariants

- Plan version requires a name
- Plan version requires a valid type (BUDGET, FORECAST, or SIMULATION)
- Plan version must reference a valid companyId; the company must be in ACTIVE status
- Plan version of type FORECAST or SIMULATION can reference a base version from which line items are copied
- Plan versions are scoped to a company; versions from different companies are fully isolated

### Relationships

- **References Company**: Each plan version is scoped to a Company via companyId (organization module)
- **Self-referencing Base Version**: A plan version optionally references another PlanVersion via baseVersionId for copying line items
