# GetFinancialStatement

## Overview

GetFinancialStatement retrieves a single financial statement record by id, including all line items. The financial statement record contains the generation parameters (companyId, statement type, reporting date or date range, method for cash flow, status) and the full list of line items organized by account group sections. This query supports statement review, finalization workflows, and audit evidence retrieval.

## Business Rules

- Accepts a single lookup parameter: `{ id }`
- Returns the full financial statement record including all line items
- Line items are structured according to the account group hierarchy from coa-management, with section headings and subtotals
- Statement types include BALANCE_SHEET, PROFIT_AND_LOSS, and CASH_FLOW
- Returns null if no matching financial statement is found
- Lookup is an exact match on id

## Process Flow

```mermaid
flowchart TD
    A[Receive input with id] --> B[SELECT from FinancialStatement where id = input.id]
    B --> C{Financial statement found?}
    C -->|Yes| D[Load all associated line items]
    D --> E[Return financial statement with line items]
    C -->|No| F[Return null]
```

## External Dependencies

- None

## Error Scenarios

- **FINANCIAL_STATEMENT_NOT_FOUND**: No financial statement matches the given id — caller receives null

## Test Cases

- returns financial statement with line items when found by id
- returns null with empty line items when not found
