# ListPeriodCloses

## Overview

ListPeriodCloses retrieves a list of period close records for a given company, with optional filters by fiscal year and status. Results are sorted by the associated accounting period's start date ascending. This query supports close coordination dashboards, audit trail review, and multi-entity close progress tracking.

## Business Rules

- companyId is required — period close records are always scoped to a company via their associated accounting period
- Optional filters:
  - `fiscalYearId` — filter to period closes within a specific fiscal year
  - `status` — filter by close status (NOT_STARTED, IN_PROGRESS, SUBLEDGERS_VERIFIED, ADJUSTMENTS_POSTED, TRIAL_BALANCE_VERIFIED, UNDER_REVIEW, SOFT_LOCKED, PERMANENTLY_CLOSED)
- All filters can be combined; when multiple filters are provided, results must match all criteria (AND logic)
- Returns full period close records (same shape as GetPeriodClose output)
- Results are sorted by the associated accounting period's start date ascending
- Returns an empty list if no period close records match the filters

## Process Flow

```mermaid
flowchart TD
    A[Receive input with companyId] --> B[Build query scoped to companyId via accounting period join]
    B --> C{Fiscal year filter provided?}
    C -->|Yes| D[Apply fiscal year filter]
    C -->|No| E{Status filter provided?}
    D --> E
    E -->|Yes| F[Apply status filter]
    E -->|No| G[Sort by associated period startDate ascending]
    F --> G
    G --> H[Return period close list]
```

## External Dependencies

- None

## Error Scenarios

- **EMPTY_RESULT**: No period close records match the given criteria — returns empty list

## Test Cases

- returns all period closes for a company
- returns period closes filtered by fiscal year
- returns period closes filtered by status
- returns empty list when no period closes match
