# WorkRegime

## Description

WorkRegime is a **company-scoped catalog** of the work/time regimes a company recognizes (e.g. STANDARD, FLEX, DISCRETIONARY) — the regime a calculation strategy and work rules key off. It replaces a fixed, platform-wide enum so each company — and each country a company operates in — can define its own set of work regimes as data rather than code. Every entry belongs to exactly one organization Company via `companyId`, carries a stable machine `key` that is unique within that company, a human-facing `displayName`, and a `status` of ACTIVE or INACTIVE.

WorkRegime is plain master data referenced by id from `WorkerEmployment`. It is not effective-dated: entries are corrected in place, and an entry that should no longer be selectable for new employments is deactivated (ACTIVE → INACTIVE) rather than deleted, so historical WorkerEmployment rows that reference it keep resolving. A deactivated entry can be reactivated (INACTIVE → ACTIVE) when it becomes selectable again.

## Domain Model Definitions

### Model type

Standard

### Command Definitions

- createWorkRegime — register a company-scoped work regime (created ACTIVE)
- updateWorkRegime — correct an entry's key or displayName in place
- deactivateWorkRegime — mark an ACTIVE entry INACTIVE so it is no longer selectable for new employments
- reactivateWorkRegime — return an INACTIVE entry to ACTIVE

### Query Definitions

- getWorkRegime — retrieve a WorkRegime by id
- getWorkRegimeByKey — resolve a company's WorkRegime by its (companyId, key) business key
- listWorkRegimes — paginated list, optionally filtered by company and/or status

### Models

- WorkRegime

### Invariants

- `key` is required and unique within its `companyId`; the same key may be reused freely across different companies
- `companyId` references exactly one organization Company; a WorkRegime belongs to that company for its whole life and is not re-parented
- `status` is one of ACTIVE or INACTIVE; entries are created ACTIVE and move only via deactivate/reactivate
- WorkRegime is a period-invariant catalog entry; it is not effective-dated, and it is referenced by id from WorkerEmployment
- A deactivated (INACTIVE) entry stays referenced by historical WorkerEmployment rows but is not offered for new employments; it is never hard-deleted

### Relationships

- **Belongs to Company**: each WorkRegime is scoped to one organization Company via `companyId` (cross-module reference)
- **Referenced by WorkerEmployment**: WorkerEmployment records the work/time regime by referencing a WorkRegime id, which a calculation strategy and work rules key off
