# TASK 1.2: Migrate large-order-wave and priority-flood

## Summary

Migrate the `large-order-wave` and `priority-flood` monitor specs to the phase-1 curated contract.

`large-order-wave` is order-only. `priority-flood` is primarily order-level and may use item-level priority only as optional supporting investigation.

## Dependencies

- TASK 1.1 (prep-time and order-surge migration)

## Files to Modify

### 1. `backend/Kds.Ai.Data/MonitorSpecs/large-order-wave.md`

Replace source-shaped order references with `curated.orders`.

### 2. `backend/Kds.Ai.Data/MonitorSpecs/priority-flood.md`

Replace source-shaped order/item references with `curated.orders` and optional `curated.order_items`.

## Required Behavior

### `large-order-wave`

Target table:

- `curated.orders`

Required curated columns:

- `created_at`
- `item_count`
- `order_type`
- `guest_table`
- `server_name`
- `preparation_time_seconds`

Migration rules:

- replace `kdsdev.orders` with `curated.orders`,
- replace `items_count` with `item_count`,
- replace `create_time` with `created_at`,
- replace `preparation_time` with `preparation_time_seconds`,
- remove `store_guid`,
- remove `is_deleted`,
- preserve 15-order per-window rule,
- preserve large-order rule using `item_count >= 6`.

### `priority-flood`

Target tables:

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

Required curated columns:

- `curated.orders.created_at`
- `curated.orders.is_priority`
- `curated.orders.item_count`
- `curated.orders.order_type`
- `curated.orders.pos_terminal`
- `curated.orders.server_name`
- `curated.orders.preparation_time_seconds`
- `curated.order_items.created_at`
- `curated.order_items.is_priority`

Migration rules:

- replace `kdsdev.orders` with `curated.orders`,
- replace optional `kdsdev.items` investigation with `curated.order_items`,
- replace `is_priority = 1` with boolean `is_priority = true`,
- replace `items_count` with `item_count`,
- replace `create_time` with `created_at`,
- remove `store_guid`,
- remove `is_deleted`,
- preserve priority-rate thresholds.

## Acceptance Criteria

- [ ] `large-order-wave.md` references `curated.orders`
- [ ] `large-order-wave.md` does not reference `kdsdev`
- [ ] `large-order-wave.md` uses `item_count`, `created_at`, and `preparation_time_seconds`
- [ ] `priority-flood.md` references `curated.orders`
- [ ] `priority-flood.md` references `curated.order_items` only if item-level priority investigation remains
- [ ] `priority-flood.md` does not reference `kdsdev`
- [ ] `priority-flood.md` uses boolean priority semantics
- [ ] Neither monitor requires `store_guid` or `is_deleted`
- [ ] Existing thresholds and severity guidance are preserved
- [ ] No runtime code is changed in this task

## Notes

- Do not add a new priority curated view.
- Keep `curated.order_items` optional in `priority-flood` unless the prompt still needs item-level investigation.
