# GetWorkScheduleAsOf

## Overview

getWorkScheduleAsOf resolves which WorkSchedule generation was in force for an Assignment on a given date. It is the single-record "所定 as of a date" lookup behind the schedule-history view's as-of resolution: the effective-dated generation timeline is non-overlapping, so exactly one generation (or none) covers any date.

## Business Rules

- Accepts an `assignmentId` and an `asOf` date as input
- Returns the single WorkSchedule generation whose effective interval covers `asOf` — `effectiveStart <= asOf` and (`effectiveEnd` is null or `effectiveEnd >= asOf`)
- Both interval bounds are inclusive; `effectiveEnd = null` means the generation is still current
- The effective-dated resolution is owned by the workforce module, not re-derived by the app layer (issue #38)
- Returns the full generation record: `assignmentId`, `scheduledDailyMinutes`, `scheduledWeeklyMinutes`, `effectiveStart`, `effectiveEnd`, and `versionOf`

## Process Flow

```mermaid
flowchart TD
    A[Receive assignmentId and asOf] --> B[Look up the WorkSchedule generation covering asOf]
    B --> C{Found?}
    C -->|No| D[Return error: WORK_SCHEDULE_NOT_FOUND]
    C -->|Yes| E[Return the in-force WorkSchedule generation]
```

## External Dependencies

- [WorkSchedule](../model/WorkSchedule.md) model — entity being queried

## Error Scenarios

- **INVALID_DATE**: the `asOf` parameter is not a valid date
- **WORK_SCHEDULE_NOT_FOUND**: no current WorkSchedule generation exists for the given assignment

## Test Cases

- returns the generation whose effective interval covers the asOf date
- returns INVALID_DATE when asOf is malformed
- returns WORK_SCHEDULE_NOT_FOUND when no generation covers the asOf date
