# TASK 2.1: Migrate slow-kitchen and station-bottleneck

## Summary

Migrate `slow-kitchen` and `station-bottleneck` to `curated.orders` plus `curated.order_items`.

These monitors require item-level station and preparation fields, and they previously depended on `kdsdev.items` and `kdsdev.item_bumps`.

## Dependencies

- TASK 1.1 (prep-time and order-surge migration)
- TASK 1.2 (large-order-wave and priority-flood migration)

## Files to Modify

### 1. `backend/Kds.Ai.Data/MonitorSpecs/slow-kitchen.md`

Replace source-shaped order/item/workflow references with curated contracts.

### 2. `backend/Kds.Ai.Data/MonitorSpecs/station-bottleneck.md`

Replace source-shaped order/item/workflow references with curated contracts.

## Required Behavior

### `slow-kitchen`

Target tables:

- `curated.orders`
- `curated.order_items`

Required curated columns:

- `curated.orders.order_id`
- `curated.orders.created_at`
- `curated.orders.updated_at`
- `curated.orders.is_completed`
- `curated.orders.item_count`
- `curated.orders.order_type`
- `curated.orders.destination`
- `curated.orders.preparation_time_seconds`
- `curated.order_items.order_id`
- `curated.order_items.created_at`
- `curated.order_items.station_id`
- `curated.order_items.preparation_time_seconds`
- `curated.order_items.prepared_at`
- `curated.order_items.done_at`

Migration rules:

- replace `kdsdev.orders` with `curated.orders`,
- replace `kdsdev.items` with `curated.order_items`,
- remove `kdsdev.item_bumps`,
- join orders to order items on `order_id`,
- replace `done = 1` with `is_completed = true`,
- replace `device_id` with `station_id`,
- replace `preparation_time` with `preparation_time_seconds`,
- replace raw epoch fields with timestamp fields,
- remove `store_guid` and `is_deleted`,
- preserve at-least-4-of-5-stations-elevated rule.

### `station-bottleneck`

Target tables:

- `curated.orders`
- `curated.order_items`

Required curated columns:

- `curated.orders.order_id`
- `curated.orders.created_at`
- `curated.orders.is_completed`
- `curated.orders.preparation_time_seconds`
- `curated.order_items.order_id`
- `curated.order_items.station_id`
- `curated.order_items.preparation_time_seconds`
- `curated.order_items.created_at`
- `curated.order_items.workflow_status_code`
- `curated.order_items.prepared_at`
- `curated.order_items.done_at`

Migration rules:

- replace source item station grouping with `station_id`,
- remove direct item bump table references,
- use workflow columns from `curated.order_items` when workflow confirmation is needed,
- remove `store_guid` and `is_deleted`,
- preserve one-station asymmetric pattern requirement,
- preserve station reference semantics using `station_id`.

## Acceptance Criteria

- [ ] `slow-kitchen.md` references only `curated.orders` and `curated.order_items`
- [ ] `slow-kitchen.md` does not reference `kdsdev`
- [ ] `slow-kitchen.md` does not reference `item_bumps`
- [ ] `slow-kitchen.md` uses `station_id` and `preparation_time_seconds`
- [ ] `station-bottleneck.md` references only `curated.orders` and `curated.order_items`
- [ ] `station-bottleneck.md` does not reference `kdsdev`
- [ ] `station-bottleneck.md` does not reference `item_bumps`
- [ ] `station-bottleneck.md` uses workflow columns from `curated.order_items`
- [ ] Neither monitor requires `store_guid` or `is_deleted`
- [ ] Existing thresholds and severity guidance are preserved
- [ ] No runtime code is changed in this task

## Notes

- Keep the distinction between slow kitchen and station bottleneck intact.
- Do not create a public `curated.item_bumps` contract.
