# CreateWorkRegime

## Permission Scope

`workRegime`

## Overview

CreateWorkRegime registers a company-scoped WorkRegime catalog entry (a `key` plus a `displayName`), created ACTIVE, so a company can define its own work/time regimes (e.g. STANDARD, FLEX, DISCRETIONARY) as data instead of a fixed enum — the regime a calculation strategy and work rules key off.

## Business Rules

- The entry is scoped to the given `companyId`; `key` must be unique within that company
- The same `key` may be reused in a different company — uniqueness is per company, not global
- The entry is created with `status` ACTIVE and is immediately selectable for new employments
- `companyId`, `key`, and `displayName` are all required inputs

## Process Flow

```mermaid
flowchart TD
    A[Admin creates WorkRegime: companyId, key, displayName] --> B{key already used in this company?}
    B -- Yes --> C[Reject: DUPLICATE_WORK_REGIME_KEY]
    B -- No --> D[Insert WorkRegime with status ACTIVE]
    D --> E[Entry selectable for new WorkerEmployments]
```

## External Dependencies

- [workforce::WorkRegime](../model/WorkRegime.md) model — the entity this command creates
- organization::Company (cross-module) — the company the catalog entry is scoped to via `companyId`

## Error Scenarios

- **DUPLICATE_WORK_REGIME_KEY**: a work regime with the given key already exists in the company

## Test Cases

- creates an ACTIVE work regime with the given key and displayName
- a duplicate key within the same company is rejected
- the same key in a different company is accepted
