# TASK 4.2: Implement GetOrders Relational Decomposition And Normalization Catalog

## Summary

Implement the actual Brink normalization boundary for `Sales2.GetOrders` so persisted raw XML is decomposed into the full relational load contract set required by the existing `GetOrders` staging model.

This subtask is the core mapping step for the first `raw -> load` slice.

## Dependencies

- [TASK 4.1](./TASK4.1.md) - normalize-load orchestration and upstream raw-batch resolution

## Files to Create

### 1. GetOrders normalization catalog

Create or finalize the fixed v1 normalization catalog entry for `Sales2.GetOrders`.

Required catalog details:

- `OperationName = Sales2.GetOrders`
- `TargetContractGroup = brink_sales2_get_orders`
- emitted contract inventory
- parser version and contract version handling

## Files to Modify

### 2. Brink normalization profiles and mappers

Modify the `GetOrders` normalization path so it emits the full existing staging-model contract set rather than a one-operation-one-contract shape.

## Required Behavior

- `Sales2.GetOrders` is the only normalization source for this task
- nested collections are decomposed into separate child contracts where the staging model already defines them
- child contracts preserve parent keys and ordinals needed for deterministic joins
- emitted rows include the ETL metadata envelope
- the target contract set is verified against the existing code-backed staging model, Brink portal semantics, and the real XML sample
- normalization remains source-shaped and must not add curated business logic

## Testing

### Unit tests

Add unit tests for:

- normalization catalog correctness for `Sales2.GetOrders`
- multi-contract decomposition from one raw payload
- metadata envelope population
- parent-child key preservation
- ordinal behavior for repeated child collections
- zero-row successful normalization behavior

## Acceptance Criteria

- [x] `GetOrders` normalization catalog exists for the narrowed v1 scope
- [x] `GetOrders` emits the required relational contract set
- [x] Emitted rows preserve ETL metadata and deterministic join fields
- [x] Unit tests cover decomposition and metadata behavior

## Notes

- Keep this subtask focused on mapping and contract emission.
- Do not implement S3 `load/` persistence here; that belongs to `TASK 4.3`.
