# GetWorkRule

## Overview

GetWorkRule retrieves a single `WorkRule` generation by its surrogate id, returning the rounding configuration, break deduction, daily overtime threshold, night-work window, and premium-category pins, along with effective-dating fields.

## Business Rules

- Resolves a single generation by surrogate `id`; because WorkRule is effective-dated (ADR-013), an id identifies exactly one generation, not the whole history for its `versionOf`
- All time quantities (`unitMinutes`, `breakDeductionMinutes`, `dailyOvertimeThresholdMinutes`, night-window bounds) are returned as minutes-based integers
- `premiumRatePercent` entries are returned keyed by TimeEntryCode `category`/`key`, never by display name; they are pins and carry no percent value (ADR-015)
- A WorkRule defines mechanics only; the returned record has no embedded worker assignment — assignment is a separate effective-dated binding (`assignWorkRule`)

## Process Flow

```mermaid
flowchart TD
    A[Caller provides WorkRule id] --> B[Look up generation by id]
    B --> C{Found?}
    C -- Yes --> D[Return generation: rounding, break, overtime threshold, night window, premium-category pins, effectiveStart/End]
    C -- No --> E[Return WORK_RULE_NOT_FOUND]
```

## External Dependencies

- [time-tracking::WorkRule](../model/WorkRule.md) model — entity being queried
- [time-tracking::TimeEntryCode](../model/TimeEntryCode.md) model — referenced by `category`/`key` for premium-category pin entries

## Error Scenarios

- **WORK_RULE_NOT_FOUND**: no WorkRule exists for the given id, or no WorkRule is effective for the relevant date
- **VALIDATION_ERROR**: the supplied input is malformed, out of range, or references an unrecognized enum value

## Test Cases

- returns the WorkRule generation when found by id
- returns WORK_RULE_NOT_FOUND when no generation matches the id
- premium-category pins reference a TimeEntryCode by category/key, not by display name
- returns rounding configuration separately for clock-in, clock-out, and break
