# GetEligibilityRule

## Overview

GetEligibilityRule retrieves a single `EligibilityRule` generation by its surrogate id, returning the target (worker/position/job-profile/employment-type) and the grant (WorkRule identity) it declares, along with effective-dating fields.

## Business Rules

- Resolves a single generation by surrogate `id`; because eligibility is effective-dated (ADR-013), an id identifies exactly one generation, not the whole history for its `versionOf`
- The target is returned by stable id (`targetType` + `targetId`: a worker / position / job-profile id, or an EmploymentType / WorkRegime catalog id), never by display name
- The grant is returned by stable key — a WorkRule identity — never by display name (ADR-015, issue #14)

## Process Flow

```mermaid
flowchart TD
    A[Caller provides EligibilityRule id] --> B[Look up generation by id]
    B --> C{Found?}
    C -- Yes --> D[Return generation: target, grant, effectiveStart/End]
    C -- No --> E[Return ELIGIBILITY_RULE_NOT_FOUND]
```

## External Dependencies

- [time-tracking::EligibilityRule](../model/EligibilityRule.md) model — entity being queried
- [time-tracking::WorkRule](../model/WorkRule.md) model — referenced as the granted work rule

## Error Scenarios

- **ELIGIBILITY_RULE_NOT_FOUND**: no EligibilityRule exists for the given id
- **VALIDATION_ERROR**: the supplied input is malformed, out of range, or references an unrecognized enum value

## Test Cases

- returns the EligibilityRule generation when found by id
- returns ELIGIBILITY_RULE_NOT_FOUND when no generation matches the id
- returns the target and grant by id/key/enum, never by display name
