# ListFiscalYears

## Overview

ListFiscalYears retrieves a list of fiscal years for a given company, with optional date range filtering. Results are sorted by startDate ascending. This query supports fiscal calendar navigation, period setup workflows, and year-end close coordination.

## Business Rules

- companyId is required — fiscal years are always scoped to a company
- Optional filters:
  - `startDate` / `endDate` — filter fiscal years overlapping the specified date range
- Returns full fiscal year records (same shape as GetFiscalYear output)
- Results are sorted by startDate ascending
- Returns an empty list if no fiscal years match the filters

## Process Flow

```mermaid
flowchart TD
    A[Receive input with companyId] --> B[Build query scoped to companyId]
    B --> C{Date range filter provided?}
    C -->|Yes| D[Apply date range filter to query]
    C -->|No| E[Return all fiscal years for company]
    D --> E
    E --> F[Sort by startDate ascending]
    F --> G[Return fiscal year list]
```

## External Dependencies

- None

## Error Scenarios

- **EMPTY_RESULT**: No fiscal years match the given criteria — returns empty list

## Test Cases

- returns all fiscal years for a company
- returns fiscal years filtered by startDate
- returns fiscal years filtered by endDate
- returns empty list when no fiscal years match
