# ListPendingLeaveApprovals

## Overview

Lists the LeaveRequest rows awaiting a decision, for an approver's inbox. This is the query that
surfaces "what do I need to decide on" for a leave approver.

**Simplified implementation (known gap).** The full intent per ADR-003 is to return requests whose
status is PENDING or CANCEL_PENDING, joined to their mirroring `approval`-module request, and scoped
to only the requests the calling approver is an eligible assignee for (self-approval never surfaced).
That requires an "eligible approver" concept that is not available to this module yet — it lives in
the approval module and is not wired up as an injected query. Until that integration exists, this
query implements a **simplified** version: it filters `LeaveRequest` to `status = PENDING` only, with
no approval-module join, no per-caller eligible-approver scoping, and no `NOT_ASSIGNEE` check. It
returns every PENDING request to every caller. The `CANCEL_PENDING` status, the approval-module join,
and the `NOT_ASSIGNEE` guard are tracked as known gaps to close once the approval module exposes the
needed cross-module query.

## Business Rules

- Returns requests whose status is PENDING (simplified — see Known Gap above; CANCEL_PENDING is not yet included)
- Paginated

## Process Flow

```mermaid
flowchart TD
    A[Approver requests their pending leave approvals] --> B[Filter LeaveRequest where status is PENDING]
    B --> C[Paginate and return the inbox]
```

## External Dependencies

- [leave-management::LeaveRequest](../model/LeaveRequest.md) model — entity being queried
- approval module (bundled) — not yet joined; see Known Gap in Overview

## Error Scenarios

- None implemented yet. **NOT_ASSIGNEE** is the target error for when no eligible approver other
  than the requester exists, or the resolver is not an eligible approver — deferred until the
  eligible-approver / approval-module integration lands (see Known Gap above)

## Test Cases

- returns requests in PENDING status
- excludes terminal requests (APPROVED, REJECTED, CANCELLED)
- excludes CANCEL_PENDING requests (known simplification — see Known Gap in Overview)
- returns an empty inbox when there are no PENDING requests
