{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.kodemed.ch/_common/EventType.schema.json",
  "title": "KodeMed Event Type",
  "description": "Canonical enum of every event name the server emits — used as the discriminator in the WebSocket envelope (`type`) AND as the `eventType` field in webhook payloads. One source of truth: adding an event in code REQUIRES adding the name here first, or both the webhook and WebSocket tests fail. Drift (different enum values per flow) is impossible by construction (#640).\n\n## Subsets\n- **Webhook-relevant:** `case.coded`, `case.discarded`, `session.expired` — the terminal-state events partners receive on their HIS webhook URL.\n- **WebSocket-only (CodingClient):** `session.created`, `code.added`, `code.removed`, `grouping.refreshed`, `dll.heartbeat`, `dll.connected`, `dll.disconnected` — intermediate / heartbeat traffic.\n- **Naming convention:** `case.coded` and `case.discarded` are case-level outcomes (the coder pressed Apply or Discard); `session.*` events describe the session container lifecycle. The two namespaces stay disjoint.",
  "type": "string",
  "enum": [
    "case.coded",
    "case.discarded",
    "session.created",
    "session.expired",
    "code.added",
    "code.removed",
    "grouping.refreshed",
    "dll.heartbeat",
    "dll.heartbeat_ack",
    "dll.connected",
    "dll.disconnected",
    "app.coding_session_launch",
    "app.ui_session_joined",
    "app.ui_session_join",
    "app.ui_session_leave",
    "app.session_cancelled",
    "app.session_action",
    "app.session_close",
    "app.process_request",
    "app.config_request",
    "app.error"
  ],
  "examples": [
    "case.coded",
    "case.discarded",
    "code.added"
  ]
}
