# GetWorkRegimeByKey

## Overview

Resolves a company's WorkRegime by its stable `(companyId, key)` business key — the lookup callers use when validating a WorkerEmployment's work regime. It returns null (not an error) when no entry matches.

## Business Rules

- Looks up by the `(companyId, key)` pair, which is unique within a company, so at most one entry is returned
- Returns null rather than raising an error when the company has no entry for the given key
- The same `key` in a different company resolves independently — the lookup is always scoped by `companyId`
- Returns the entry regardless of status; callers decide whether an INACTIVE entry is acceptable

## Process Flow

```mermaid
flowchart TD
    A[Caller requests WorkRegime by companyId + key] --> B{Entry with this companyId and key exists?}
    B -- No --> C[Return null]
    B -- Yes --> D[Return the matching WorkRegime]
```

## External Dependencies

- [workforce::WorkRegime](../model/WorkRegime.md) model — entity being queried

## Error Scenarios

- No error is raised; an absent (companyId, key) resolves to null rather than an error

## Test Cases

- returns the WorkRegime matching a companyId and key
- returns null when no entry matches the companyId and key
- the same key in a different company is not returned
