# Staff Court Monitor (Mobile) — Cross-Role Handoffs

> The cross-role touchpoints this role fires into / receives from. The Monitor is a **producer of submissions** (into the approval cascade) and a **receiver of send-backs**. It never approves (`PROJECT_PLAN §3`). Cascade mechanics live in `FOUNDATION_SPEC §4`.

---

## Upstream input (what arrives at the Monitor)

| From | Trigger | What the Monitor receives | Surfaces on |
|---|---|---|---|
| **Store Manager / Team Leader** | Roster **published** (`SM-ROSTER-PUBLISH` / `TL-ROSTER`) | Auto-assign fires → `ChecklistInstance`s for Ramesh's roster entry (role + certified ride + shift → templates; e.g. Trampoline Daily + Opening if opener) | `MON-DASH`, `MON-CHK-TODAY` + a `ROSTER_PUBLISHED` notification |
| **Team Leader / Store Manager / Operation Head** | **Send-back** at any approval step (`TL-CHK-VERIFY` / `SM-CHK-APPROVE` / `OH-CHK-APPROVE`) | Instance state → `SENT_BACK`, with the reject reason. Returns to **Ramesh, the original filler** (§9 #3) — not the previous approver | `MON-CHK-STATUS` (red banner + Re-fill) + a `SENT_BACK` notification (FCM + in-app) |

## Downstream output (what the Monitor fires)

| To | Trigger | What fires | Lands on |
|---|---|---|---|
| **Team Leader (Priya)** | Ramesh **submits** a checklist (`MON-CHK-SUBMIT` → `POST …/submit`) | Instance state → `SUBMITTED`; `ApprovalStep` rows (TL/SM/OH) created; **TL notified** (FCM + in-app). The TL's verify queue gains this instance | `TL-CHK-VERIFY` / `TL-CHK-OVERVIEW` + a notification to Priya |
| **Up the chain (derived)** | submission climbs the cascade | While not yet OH-approved, the instance reads **Pending** to TL/SM/OH per their level (derived, L8); the Monitor still sees the real sub-state | `OH-DASH` / `*-CHK-OVERVIEW` Pending counts |
| **Reports (roll-up)** | items recorded | Ramesh's **G** items feed the Positive report; **A** items + their issue photos feed the Negative report (per ride/shift/day/Game Zone) | `*-REP-POSITIVE`, `*-REP-NEGATIVE` (TL/SM/OH packs) |
| **Overdue escalation** | `now() > dueAt` and not submitted | Instance → `OVERDUE`; escalates up the chain | `*-REP-OVERDUE`, dashboards |

## The closed loop (anchor end-to-end)

```
SM publishes roster ──auto-assign──▶ MON-CHK-TODAY (Ramesh: Trampoline Daily)
        ▲                                    │ fill G/A + completion photo + per-A photo
        │ send-back (to Ramesh)              ▼ submit  ──notify──▶  TL verify queue (Priya)
   MON-CHK-STATUS  ◀────────────── (any approver rejects)              │ approve
   (red banner, Re-fill)                                               ▼
                                                          SM approve ─▶ OH approve = DONE
                                            (until OH approves, everyone above sees PENDING)
```

## Contract notes for the BE dev
- The **submit** handler is the single producer-side touchpoint: on success it (1) transitions state, (2) creates the 3 `ApprovalStep`s, (3) enqueues the TL notification (FCM fan-out to Priya's `DeviceToken`s + an in-app `Notification`). Implement once; the TL pack consumes the queue.
- The **send-back** handler (TL/SM/OH packs) must set `state=SENT_BACK` and notify the **original `fillerId`**, not the previous approver — the Monitor pack only *reads* this outcome via `/me/notifications` + `/me/submissions`.
- Do **not** expose any approve/sendback endpoint to MON — the resolver denies it (403). This pack consumes none of them.
