# ListFinancialStatements

## Overview

ListFinancialStatements retrieves a list of financial statements for a given company, with optional filters for statement type, status, and date range. Results are sorted by creation date descending. This query supports statement management, audit review, and reporting history navigation.

## Business Rules

- companyId is required — financial statements are always scoped to a company
- Optional filters:
  - `statementType` — filter by statement type (BALANCE_SHEET, PROFIT_AND_LOSS, CASH_FLOW)
  - `status` — filter by status (DRAFT, FINALIZED)
  - `dateRange` — filter by reporting date or date range overlap
- All filters can be combined; when multiple filters are provided, results must match all criteria (AND logic)
- Returns financial statement records including header fields (line items are not included in list results for performance)
- Results are sorted by creation date descending
- Returns an empty list if no financial statements match the filters

## Process Flow

```mermaid
flowchart TD
    A[Receive input with companyId] --> B[Build query scoped to companyId]
    B --> C{Filters provided?}
    C -->|Yes| D[Apply statementType, status, and/or dateRange filters]
    C -->|No| E[Return all financial statements for company]
    D --> E
    E --> F[Sort by creation date descending]
    F --> G[Return financial statement list]
```

## External Dependencies

- None

## Error Scenarios

- **EMPTY_RESULT**: No records match the given criteria

## Test Cases

- returns all financial statements for a company
- returns financial statements filtered by statement type
- returns financial statements filtered by status
- returns financial statements filtered by dateRange
- returns empty list when no financial statements match
