# ListWorkRuleAssignments

## Overview

ListWorkRuleAssignments returns a paginated list of `WorkRuleAssignment` generations, history included, optionally filtered by the referenced WorkRule. It answers "who has been on this rule over time" for admin screens and audits.

## Business Rules

- History included: closed generations (`effectiveEnd` set) are returned alongside current ones, so the full assignment timeline of a target is reconstructable (ADR-013)
- Optional `workRuleId` filter narrows to the assignments referencing one WorkRule generation series
- Results are paginated with a stable default ordering

## Process Flow

```mermaid
flowchart TD
    A[Caller provides optional workRuleId filter and pagination] --> B[Query WorkRuleAssignment generations]
    B --> C{workRuleId filter provided?}
    C -- Yes --> D[Restrict to assignments referencing that WorkRule]
    C -- No --> E[All generations]
    D --> F[Apply ordering and pagination]
    E --> F
    F --> G[Return page of generations with total count]
```

## External Dependencies

- [time-tracking::WorkRuleAssignment](../model/WorkRuleAssignment.md) model — entity being listed
- [time-tracking::WorkRule](../model/WorkRule.md) model — referenced by the optional filter

## Error Scenarios

- **VALIDATION_ERROR**: the supplied input is malformed, out of range, or references an unrecognized enum value

## Test Cases

- returns paginated WorkRuleAssignment generations including closed (historical) ones
- filters by workRuleId when provided
- applies limit/offset pagination and reports whether a next page exists
