# GetItem

## Overview

GetItem retrieves a single item record by id, sku, or barcode. The input is a union type — callers specify exactly one lookup field. This serves as the core item lookup for existence checks, uniqueness validation, and all item lifecycle commands.

## Business Rules

- Accepts one of three lookup variants:
  - `{ id }` — retrieves by unique identifier (most common, used for existence/state checks)
  - `{ sku }` — retrieves by SKU code (used for uniqueness validation during creation; SKU is immutable after creation)
  - `{ barcode }` — retrieves by barcode (used for uniqueness validation)
- Returns the full item record including all fields (id, sku, name, barcode, unitId, status, timestamps)
- Returns null if no matching item is found
- All comparisons are exact (case-sensitive)

## Process Flow

```mermaid
flowchart TD
    A[Receive input] --> B{Which field?}
    B -->|id| C[SELECT from Item where id = input.id]
    B -->|sku| D[SELECT from Item where sku = input.sku]
    B -->|barcode| E[SELECT from Item where barcode = input.barcode]
    C --> H{Item found?}
    D --> H
    E --> H
    H -->|Yes| I[Return item record]
    H -->|No| J[Return null]
```

## External Dependencies

- None

## Error Scenarios

- **ITEM_NOT_FOUND**: Specified item ID does not exist

## Test Cases

- returns item when found
- returns null when item not found
- returns item when found
- returns null when item not found
- returns item when found
- returns null when item not found
