{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.kodemed.ch/_common/CaseResult.schema.json",
  "title": "KodeMed Case Result (one case)",
  "description": "Per-case bundle: the coded SPIGES XML (via composed `_common/CaseData`) + the grouper output (via `_common/CodingResult`). Used as the array-item shape in the COM `GetResults()` envelope (multi-case return) and as the singleton inside the WebSocket `case.coded` payload — same shape both transports, no drift (#640).\n\n## Why a separate fragment\n\nThe HIS REST `WebhookPayload-1.0` is per-session: one payload, one (optional) `data` + `codingResult`. The COM `GetResults()` is per-call across N cases: one envelope, an array of N `{data, codingResult}` bundles. CaseResult captures that bundle ONCE so both transports parse it with the same code path; the model-separation invariant (no `<GrouperResult>` inside `<Fall>`) is enforced at the bundle level, not duplicated per flow.\n\n## Composition\n\n- `allOf` _common/CaseData → contributes `data`, `format`, `dataHash`, `schemaVersion`\n- `codingResult` → \\$ref _common/CodingResult (full grouper output: tariff, drg, pccl, supplements, …)\n\nThe `caseId` (= SPIGES `<Fall fall_id>`) lives inside `codingResult.caseId` — ONE location, no duplication.",
  "type": "object",
  "allOf": [
    { "$ref": "CaseData.schema.json" }
  ],
  "properties": {
    "codingResult": {
      "$ref": "CodingResult.schema.json",
      "description": "Grouper output for this case. The `caseId` inside echoes the SPIGES `<Fall fall_id>` so partners can correlate result-to-case when the bundle is one of many in a GetResults() return."
    }
  }
}
