# V1 Block 21 — Notification Abstraction Layer

**Purpose**: Define NotificationAdapter contract.

> **Note for Codex**: Follow tasks exactly; avoid exploratory calls when tasks specify names/files/tests.

## Chunk 21.1 — NotificationAdapter contract
Recommended level: **XHIGH**

Status: Complete on 2026-06-26.

### Tasks
1. Add package **`packages/scheduler_notifications`**.
2. Declare sealed class `NotificationRequest` with fields: `id`, `title`, `body`, `scheduledDateTimeUtc`, `payloadJson`.
3. Declare enum `NotificationFeedbackType` (clicked,dismissed,action).
4. Define abstract `NotificationAdapter` with methods `Future<void> schedule(NotificationRequest)`, `Future<void> cancel(String id)`, `Stream<NotificationFeedback>`.
5. Add stub `FakeNotificationAdapter` for tests emitting events via StreamController.

### Acceptance criteria
1. Package compiles and `dart test` passes stub test `fake_adapter_test.dart`.

### Completed implementation
1. Added package `packages/scheduler_notifications` with public entry points `notifications.dart` and `scheduler_notifications.dart`.
2. Added sealed `NotificationRequest` with factory construction and fields `id`, `title`, `body`, `scheduledDateTimeUtc`, and `payloadJson`.
3. Added `NotificationFeedbackType` with `clicked`, `dismissed`, and `action`.
4. Added `NotificationFeedback` event model.
5. Added abstract `NotificationAdapter` with `schedule`, `cancel`, and `feedback`.
6. Added `FakeNotificationAdapter` backed by a broadcast `StreamController`.
7. Wired fake adapter tests into the root test wrapper.

### Verification
1. `dart pub get`: passed.
2. `dart format test/scheduler_core_test.dart packages/scheduler_notifications`: passed.
3. `cd packages/scheduler_notifications && dart analyze`: passed, no issues found.
4. `cd packages/scheduler_notifications && dart test`: passed, 2 tests.
5. `dart analyze`: passed, no issues found.
6. `dart test`: passed, 318 tests.
7. `scripts/test.sh`: not present or not executable.

---
