# GetLeaveRequest

## Overview

Retrieves a single LeaveRequest by id, in any status (PENDING, APPROVED, REJECTED, CANCELLED, CANCEL_PENDING), for detail views and lookups by the requester, an approver, or an administrator.

## Business Rules

- Returns the request matching the given id regardless of its current status, including terminal states (REJECTED, CANCELLED)
- Returns the full request record: `workerId`, `assignmentId`, `leaveTypeKey`, `targetDate`(s), `reason`, `status`, and the resolution trail (`resolvedBy`, `resolvedAt`)
- Does not itself return the mirroring approval request or the consumption lines — callers needing those use the approval module directly or `listLeaveConsumptionByRequest`

## Process Flow

```mermaid
flowchart TD
    A[Caller requests LeaveRequest by id] --> B{Request with matching id exists?}
    B -- No --> C[Reject: LEAVE_REQUEST_NOT_FOUND]
    B -- Yes --> D[Return the request in its current status]
```

## External Dependencies

- [leave-management::LeaveRequest](../model/LeaveRequest.md) model — entity being queried
- [workforce::Worker](../../../workforce/docs/model/Worker.md) model — referenced by `workerId`
- [workforce::Assignment](../../../workforce/docs/model/Assignment.md) model — referenced by `assignmentId`

## Error Scenarios

- **LEAVE_REQUEST_NOT_FOUND**: no LeaveRequest exists for the given id

## Test Cases

- returns the request when found by id
- returns a request in a terminal status (REJECTED or CANCELLED), not only active ones
- returns a CANCEL_PENDING request with its resolution trail so far
- returns LEAVE_REQUEST_NOT_FOUND for a non-existent id
