# GetAppointment

## Overview

Retrieves a single AppointmentHistory entry (appointment) by its id, returning the full record of an appointment event — type, effective date, issue date, from/to Position, and the Assignment it created or changed.

## Business Rules

- Returns the AppointmentHistory entry exactly as recorded; entries are append-only and never modified, so the returned record is always the original entry, never a corrected version
- A HIRE entry has no from-Position; a TERMINATION entry has no to-Position
- `appointmentTypeId` is returned as the AppointmentType catalog id recorded on the entry
- Both `effectiveDate` (when the appointment takes effect) and `issuedAt` (appointment issue date) are returned, even when the appointment is future-dated

## Process Flow

```mermaid
flowchart TD
    A[Caller requests appointment by id] --> B{Entry exists?}
    B -- No --> C[Reject: APPOINTMENT_NOT_FOUND]
    B -- Yes --> D[Return AppointmentHistory entry: type, effectiveDate, issuedAt, from/to Position, Assignment reference]
```

## External Dependencies

- [workforce::AppointmentHistory](../model/AppointmentHistory.md) model — entity being queried
- [workforce::Assignment](../model/Assignment.md) model — referenced by the appointment's `assignmentId`

## Error Scenarios

- **APPOINTMENT_NOT_FOUND**: no AppointmentHistory entry exists for the given id

## Test Cases

- returns the appointment entry when found by id
- returns NOT_FOUND when the id does not exist
- a HIRE entry is returned with no from-Position
- a TRANSFER entry is returned with both from-Position and to-Position populated
- a future-dated appointment is returned with `issuedAt` preceding `effectiveDate`
