# GetCostCenter

## Overview

GetCostCenter retrieves a single cost center record by id, including all master data fields (code, name, description, category, responsible person, department reference, validity period) and the hierarchy node assignment within the cost center hierarchy. This is the primary query for viewing cost center details, validating cost center configuration, and supporting cost posting, budget, and allocation workflows.

## Business Rules

- Accepts a single lookup parameter: `{ id }`
- Returns the full cost center record including all master data fields
- Includes the hierarchy node assignment (node id and hierarchy reference) for the cost center
- Returns null if no matching cost center is found
- Lookup is an exact match on id

## Process Flow

```mermaid
flowchart TD
    A[Receive input with id] --> B[SELECT from CostCenter where id = input.id]
    B --> C{Cost center found?}
    C -->|Yes| D[Load hierarchy node assignment]
    D --> E[Return cost center with hierarchy node]
    C -->|No| F[Return null]
```

## External Dependencies

- None

## Error Scenarios

- **COST_CENTER_NOT_FOUND**: Referenced cost center does not exist or does not belong to the same company

## Test Cases

- returns cost center with all fields and hierarchy node assignment when found by id
- returns cost center with responsible person and department reference populated
- returns null when no cost center matches the given id
