# TASK 2.1: Implement Child Extract Orchestration And Business-Date Resolution

## Summary

Implement the tenant-day child extract entry point and the Warehouse/app-layer orchestration flow that starts one `extract_raw` run for Brink POS orders. This subtask should turn the dispatch contract from `TASK1.md` into a concrete execution path that resolves the effective business date, resolves the active Brink binding for the tenant, and prepares endpoint execution metadata.

## Dependencies

- [TASK 1](./TASK1.md) - source binding and dispatch

## Files to Create

### 1. Extract orchestration services

Create or finalize the Warehouse/app-layer services responsible for one tenant-day `extract_raw` execution.

Recommended logical services:

- `BrinkPosExtractJobs`
- `IBrinkConnectionBindingService` or equivalent Warehouse-side binding resolver
- `BrinkPosBusinessDateResolver`
- `BrinkPosExtractOrchestrator`
- `BrinkPosEndpointCatalog`

### 2. Endpoint catalog for the narrowed v1 scope

Create the fixed catalog for this slice with:

- `GetCurrentBusinessDate` as the control helper
- `GetOrders` as the only replayable raw endpoint

## Required Behavior

- child extract accepts `BrinkPosExtractJobInput`
- child extract resolves `BrinkConnectionDefinition` outside `Kds.Ai.Integrations.BrinkPos`
- explicit `BusinessDate` wins when provided
- otherwise the resolver calls `GetCurrentBusinessDate`
- the resolved date becomes the single tenant-day execution boundary
- the catalog remains strict and does not include any additional Brink endpoint
- the orchestration layer passes the resolved Brink connection context into the integration boundary rather than relying on ambient tenant or DB resolution inside the integration module

## Testing

### Unit tests

Add unit tests for:

- Warehouse-side binding resolution and handoff of `BrinkConnectionDefinition`
- explicit business-date override
- missing business-date path through `GetCurrentBusinessDate`
- endpoint catalog correctness for the narrowed scope
- orchestration handoff from child job to endpoint execution

## Acceptance Criteria

- [ ] Child extract job entry exists
- [ ] Warehouse/app-layer binding resolution exists for the child extract path
- [ ] Business-date resolver exists
- [ ] Explicit `BusinessDate` is honored directly
- [ ] Missing `BusinessDate` resolves through `GetCurrentBusinessDate`
- [ ] Endpoint catalog includes only the narrowed v1 scope
- [ ] Child orchestration passes explicit Brink connection context into the integration boundary
- [ ] Unit tests cover business-date and catalog behavior

## Notes

- Keep this subtask focused on orchestration readiness.
- Keep tenant resolution and source-binding lookup out of `Kds.Ai.Integrations.BrinkPos`.
- Do not implement raw S3 persistence or validation here; those belong to later subtasks in TASK 2.
