# GetInventoryCount

## Overview

GetInventoryCount retrieves a single inventory count document with all its count lines. This serves as the detail view for a specific physical inventory count, including variance calculations and line-level status.

## Business Rules

- Requires `id`
- Returns the full InventoryCount record with nested InventoryCountLine records
- Each count line includes:
  - Expected quantity (from system)
  - Counted quantity (from physical count)
  - Variance (counted - expected)
  - Line status: `pending`, `approved`, `rejected`, or `recount`
- Returns error if the inventory count document is not found

## Process Flow

```mermaid
flowchart TD
    A[Receive id] --> B[SELECT from InventoryCount where id matches]
    B --> C{Count found?}
    C -->|Yes| D[Include all InventoryCountLine records]
    D --> E[Compute variance for each line]
    E --> F[Return InventoryCount with lines]
    C -->|No| G[Return COUNT_NOT_FOUND error]
```

## External Dependencies

- None

## Error Scenarios

- **COUNT_NOT_FOUND**: No inventory count document matches the given id

## Test Cases

- returns count with lines when found
- includes variance for each line
- returns error when not found
- includes line status (pending/approved/rejected/recount)
