# GetTaxonomyNode

## Overview

GetTaxonomyNode retrieves a single taxonomy node by id or code. The input is a union type — callers specify exactly one lookup field. This serves as the core taxonomy node lookup for existence checks, uniqueness validation, and as the starting point for tree traversal operations.

## Business Rules

- Accepts one of two lookup variants:
  - `{ id }` — retrieves by unique identifier (used for existence checks and tree operations)
  - `{ code }` — retrieves by code (used for uniqueness validation during creation; code is immutable after creation)
- Returns the full taxonomy node record (id, code, name, parentId, timestamps)
- Returns null if no matching node is found
- All comparisons are exact (case-sensitive)

## Process Flow

```mermaid
flowchart TD
    A[Receive input] --> B{Which field?}
    B -->|id| C[SELECT from TaxonomyNode where id = input.id]
    B -->|code| D[SELECT from TaxonomyNode where code = input.code]
    C --> E{Node found?}
    D --> E
    E -->|Yes| F[Return node record]
    E -->|No| G[Return null]
```

## External Dependencies

- None

## Error Scenarios

- **NODE_NOT_FOUND**: Specified taxonomy node ID does not exist

## Test Cases

- returns node when found
- returns null when node not found
- returns node when found
- returns null when node not found
