# GetDepartment

## Overview

GetDepartment retrieves a single department by its unique identifier or by its company-scoped code. Returns the full department record including status, code, name, company reference, and parent department reference, or null if no matching department exists.

## Business Rules

- Lookup by `id` performs an exact UUID match
- Lookup by `code` + `companyId` performs a compound match (code is unique per company, not globally)
- Returns the full department record including status, code, name, companyId, and parentDepartmentId
- Does not filter by status — returns both ACTIVE and INACTIVE departments
- Exactly one lookup mode must be used: `id` alone, or `code` + `companyId` together
- Returns null when no matching department is found

## Process Flow

```mermaid
flowchart TD
    A[Receive lookup request] --> B{Lookup by id or code?}
    B -->|id| C[Query Department by id]
    B -->|code + companyId| D[Query Department by code and companyId]
    C --> E{Found?}
    D --> E
    E -->|Yes| F[Return department]
    E -->|No| G[Return null]
```

## External Dependencies

- None

## Error Scenarios

- None (returns null when not found instead of throwing)

## Test Cases

- returns department when found by id
- returns department when found by code and companyId
- returns null when department not found by id
- returns null when department not found by code
- returns ACTIVE department
- returns INACTIVE department
