{
  "openapi": "3.1.0",
  "info": {
    "title": "OHN-29 Public Health and Aggregate Reporting",
    "version": "1.0.1",
    "description": "Server paths are under /api/ohn/v1/aggregate-reporting. Default deny: role AND purpose must match. Inventory paths OHN-29-API-001..003 are mapped to this disjoint prefix (see ADR-0001). Only aggregates are stored; suppressed cells carry no value and no counts. Reports of another jurisdiction are 404. Behaviour reconciled with the TypeScript reference and the Java service (docs/program/java/ohn-29-contract-changes.md). Tokens come from the platform gateway (ES256, audience ohn-29); the TypeScript-only synthetic-token endpoint is not part of this contract."
  },
  "servers": [
    {
      "url": "/api/ohn/v1/aggregate-reporting"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/dashboard": {
      "get": {
        "operationId": "dashboard",
        "summary": "Reporting dashboard: counts by state, awaiting correction, overdue",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Dashboard"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/indicators": {
      "post": {
        "operationId": "createIndicator",
        "summary": "Configure an indicator definition (F001); immutable once created",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IndicatorCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndicatorResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listIndicators",
        "summary": "Indicator definitions",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "retired"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndicatorList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/indicators/{id}/retire": {
      "post": {
        "operationId": "retireIndicator",
        "summary": "Retire an indicator definition",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RetireCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndicatorResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/indicator-sets": {
      "post": {
        "operationId": "createIndicatorSet",
        "summary": "Create a fixed set of indicators to report on",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IndicatorSetCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndicatorSetResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listIndicatorSets",
        "summary": "Indicator sets",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndicatorSetList"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/policy": {
      "get": {
        "operationId": "getPolicy",
        "summary": "Disclosure policy (minimum cell size, deadline) of the jurisdiction",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyView"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "setPolicy",
        "summary": "Set the disclosure policy with its approval reference",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PolicyResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/recipients": {
      "get": {
        "operationId": "listRecipients",
        "summary": "Authorised recipient endpoints",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Recipients"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "upsertRecipient",
        "summary": "Add or change a recipient endpoint",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecipientCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecipientResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates": {
      "post": {
        "operationId": "prepareAggregate",
        "summary": "Prepare an aggregate report (F002, W001): select, check policy, aggregate, apply disclosure control, draft",
        "x-inventory-id": "OHN-29-API-001",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listAggregates",
        "summary": "Aggregate reports",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "period_from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 10
            }
          },
          {
            "name": "period_to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 10
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates/preview": {
      "post": {
        "operationId": "previewSuppression",
        "summary": "Preview small-cell suppression without storing; withheld cells show no counts",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrepareCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Preview"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates/{id}": {
      "get": {
        "operationId": "getAggregate",
        "summary": "Report with values, approvers, history and submissions",
        "x-inventory-id": "OHN-29-API-002",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportDetail"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates/{id}/lineage": {
      "get": {
        "operationId": "getLineage",
        "summary": "Definitions, sources, policy and decisions behind the figures",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Lineage"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates/{id}/validate": {
      "post": {
        "operationId": "validateAggregate",
        "summary": "Validate a draft; records evidence when it passes",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates/{id}/approve": {
      "post": {
        "operationId": "approveAggregate",
        "summary": "Record one reviewer approval; the second distinct reviewer approves the report (W002)",
        "x-inventory-id": "OHN-29-API-003",
        "x-roles": [
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApproveResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates/{id}/reject": {
      "post": {
        "operationId": "rejectAggregate",
        "summary": "Reject a validated or approved report before submission",
        "x-roles": [
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates/{id}/submit": {
      "post": {
        "operationId": "submitAggregate",
        "summary": "Submit an approved report to a certified recipient (F003); records the recipient answer",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/aggregates/{id}/corrections": {
      "post": {
        "operationId": "correctAggregate",
        "summary": "Re-aggregate a rejected report as a new revision (W003)",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CorrectionCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/submissions": {
      "get": {
        "operationId": "listSubmissions",
        "summary": "Submission history",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmissionList"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/maintenance/drain-outbox": {
      "post": {
        "operationId": "drainOutbox",
        "summary": "Report pending outbox events (no sink: nothing claimed delivered)",
        "x-roles": [
          "public_health_officer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DrainResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/report-catalog": {
      "get": {
        "operationId": "reportCatalog",
        "summary": "Available reports",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportCatalog"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/{reportId}": {
      "get": {
        "operationId": "runReport",
        "summary": "Run report R001..R003",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jurisdiction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Another jurisdiction yields no_authorized_data"
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "period_from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "description": "A real calendar date, YYYY-MM-DD"
            }
          },
          {
            "name": "period_to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
              "description": "A real calendar date, YYYY-MM-DD"
            }
          },
          {
            "name": "recipient",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{1,63}$"
            }
          },
          {
            "name": "facility",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "indicator",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnalyticReport"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/reports/{reportId}/export": {
      "post": {
        "operationId": "exportReport",
        "summary": "Create a signed single-use report export",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExportCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportReceipt"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing/invalid Idempotency-Key (8-128 characters of [A-Za-z0-9_.:-])",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, illegal transition, report exists, already decided, or idempotency key reused",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/report-exports/{token}": {
      "get": {
        "operationId": "downloadReportExport",
        "summary": "Download a report export once",
        "x-roles": [
          "public_health_officer",
          "reporting_reviewer"
        ],
        "x-purpose": "public_health_reporting",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export, once (text/csv or application/pdf)",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "410": {
            "description": "export_expired (5 minutes) or export_consumed (single use)"
          },
          "500": {
            "description": "export_integrity_failed"
          },
          "401": {
            "description": "Unauthenticated (no/invalid token, or claims that are not uuids)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Denied by policy (role AND purpose public_health_reporting), separation of duties, publication not permitted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Not found / not disclosed (another jurisdiction; any route outside this contract)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed (details: field -> code) or an unmet precondition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Dependency unavailable (fail closed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/health/ohn-29": {
      "get": {
        "operationId": "health",
        "summary": "Public liveness; reports how each dependency is wired",
        "servers": [
          {
            "url": "/"
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Database reachable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "503": {
            "description": "Database unreachable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 8,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9_.:-]+$"
        }
      }
    },
    "schemas": {
      "IndicatorCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "jurisdiction_id": {
            "type": "string",
            "format": "uuid"
          },
          "indicator_code": {
            "type": "string",
            "pattern": "^[A-Za-z][A-Za-z0-9_.-]{1,63}$"
          },
          "definition_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          },
          "numerator_rule": {
            "type": "string",
            "minLength": 5,
            "maxLength": 4000
          },
          "denominator_rule": {
            "type": "string",
            "minLength": 5,
            "maxLength": 4000
          },
          "reporting_frequency": {
            "type": "string",
            "enum": [
              "weekly",
              "monthly",
              "quarterly",
              "annual"
            ]
          }
        },
        "required": [
          "jurisdiction_id",
          "indicator_code",
          "definition_version",
          "numerator_rule",
          "denominator_rule",
          "reporting_frequency"
        ]
      },
      "RetireCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "expected_version",
          "reason"
        ]
      },
      "IndicatorSetCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "label": {
            "type": "string",
            "minLength": 3,
            "maxLength": 256
          },
          "indicator_ids": {
            "type": "array",
            "minItems": 1,
            "maxItems": 200,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "label",
          "indicator_ids"
        ]
      },
      "PolicyCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "min_cell_size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          },
          "due_days_after_period": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 3650
          },
          "approval_reference": {
            "type": "string",
            "minLength": 3,
            "maxLength": 256
          }
        },
        "required": [
          "min_cell_size",
          "approval_reference"
        ]
      },
      "RecipientCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{1,63}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "active": {
            "type": "boolean",
            "default": true
          }
        },
        "required": [
          "code",
          "label"
        ]
      },
      "PrepareCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "period_start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "A real calendar date, YYYY-MM-DD"
          },
          "period_end": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "A real calendar date, YYYY-MM-DD"
          },
          "source_facilities": {
            "type": "array",
            "minItems": 1,
            "maxItems": 200,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "indicator_set_id": {
            "type": "string",
            "format": "uuid"
          },
          "aggregation_method": {
            "type": "string",
            "enum": [
              "facility_sum",
              "facility_breakdown"
            ]
          }
        },
        "required": [
          "period_start",
          "period_end",
          "source_facilities",
          "indicator_set_id",
          "aggregation_method"
        ],
        "description": "The period must have ended (422 period_not_closed); period_end must not precede period_start."
      },
      "ValidateCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "expected_version"
        ]
      },
      "DecisionCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "expected_version",
          "reason"
        ]
      },
      "SubmitCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "validation_evidence": {
            "type": "string",
            "minLength": 10,
            "maxLength": 200
          },
          "reviewer_a": {
            "type": "string",
            "format": "uuid"
          },
          "reviewer_b": {
            "type": "string",
            "format": "uuid"
          },
          "recipient_endpoint": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{1,63}$"
          }
        },
        "required": [
          "expected_version",
          "validation_evidence",
          "reviewer_a",
          "reviewer_b",
          "recipient_endpoint"
        ],
        "description": "reviewer_a and reviewer_b must differ and be the two reviewers who approved this revision; the submitter may be neither."
      },
      "CorrectionCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "expected_version",
          "reason"
        ]
      },
      "ExportCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "csv",
              "pdf"
            ]
          },
          "filters": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "jurisdiction": {
                "type": "string",
                "format": "uuid"
              },
              "country": {
                "type": "string",
                "format": "uuid"
              },
              "period_from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "A real calendar date, YYYY-MM-DD"
              },
              "period_to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                "description": "A real calendar date, YYYY-MM-DD"
              },
              "recipient": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{1,63}$"
              },
              "facility": {
                "type": "string",
                "format": "uuid"
              },
              "indicator": {
                "type": "string",
                "format": "uuid"
              },
              "status": {
                "type": "string",
                "maxLength": 40
              }
            }
          }
        },
        "required": [
          "format"
        ]
      },
      "Problem": {
        "type": "object",
        "description": "application/problem+json carrying the legacy fields error/message/details; 422 details are `{field: zod-issue-code | custom message}`.",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "trace_id": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "error"
        ]
      },
      "Receipt": {
        "type": "object",
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "committed_at": {
            "type": "string",
            "format": "date-time"
          },
          "aggregate_id": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "committed"
            ]
          }
        }
      },
      "Indicator": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "indicator_code": {
            "type": "string"
          },
          "definition_version": {
            "type": "string"
          },
          "numerator_rule": {
            "type": "string"
          },
          "denominator_rule": {
            "type": "string"
          },
          "reporting_frequency": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "retired"
            ]
          },
          "version": {
            "type": "integer"
          }
        }
      },
      "Value": {
        "type": "object",
        "description": "A suppressed cell carries no value and no counts; a missing cell has none either (never zero).",
        "properties": {
          "indicator_id": {
            "type": "string",
            "format": "uuid"
          },
          "facility_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "numerator": {
            "type": [
              "integer",
              "null"
            ]
          },
          "denominator": {
            "type": [
              "integer",
              "null"
            ]
          },
          "value": {
            "type": [
              "string",
              "null"
            ],
            "description": "Four decimals"
          },
          "suppressed": {
            "type": "boolean"
          },
          "suppression_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "small_numerator",
              "small_denominator",
              "complementary",
              null
            ]
          },
          "missing": {
            "type": "boolean"
          }
        }
      },
      "Issue": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "numerator_exceeds_denominator",
              "indicator_retired",
              "indicator_all_missing",
              "some_cells_missing"
            ]
          },
          "indicator_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "severity": {
            "type": "string",
            "enum": [
              "error",
              "warning"
            ]
          }
        }
      },
      "Report": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "period_start": {
            "type": "string"
          },
          "period_end": {
            "type": "string"
          },
          "indicator_set_id": {
            "type": "string",
            "format": "uuid"
          },
          "indicator_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "source_facilities": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "aggregation_method": {
            "type": "string"
          },
          "min_cell_size_applied": {
            "type": "integer"
          },
          "policy_reference": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "draft",
              "validated",
              "approved",
              "submitted",
              "acknowledged_or_rejected"
            ]
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "acknowledged",
              "rejected",
              null
            ]
          },
          "revision": {
            "type": "integer"
          },
          "correction_state": {
            "type": [
              "string",
              "null"
            ]
          },
          "correction_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "prepared_by": {
            "type": "string",
            "format": "uuid"
          },
          "validated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "validation_evidence": {
            "type": [
              "string",
              "null"
            ]
          },
          "validation_issues": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          },
          "recipient_endpoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "submitted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "attempts": {
            "type": "integer"
          },
          "rejection_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "version": {
            "type": "integer"
          }
        }
      },
      "ReportResult": {
        "type": "object",
        "properties": {
          "report": {
            "$ref": "#/components/schemas/Report"
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Value"
            }
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "IndicatorResult": {
        "type": "object",
        "properties": {
          "indicator": {
            "$ref": "#/components/schemas/Indicator"
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "IndicatorList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Indicator"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "IndicatorSetResult": {
        "type": "object",
        "properties": {
          "indicator_set": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "label": {
                "type": "string"
              },
              "indicator_ids": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            }
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "IndicatorSetList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "label": {
                  "type": "string"
                },
                "indicator_ids": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        }
      },
      "PolicyView": {
        "type": "object",
        "properties": {
          "configured": {
            "type": "boolean"
          },
          "policy": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "min_cell_size": {
                "type": "integer"
              },
              "due_days_after_period": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "approval_reference": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            }
          }
        }
      },
      "PolicyResult": {
        "type": "object",
        "properties": {
          "policy": {
            "type": "object"
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "Recipients": {
        "type": "object",
        "properties": {
          "configured": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "active": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      },
      "RecipientResult": {
        "type": "object",
        "properties": {
          "item": {
            "type": "object"
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "Preview": {
        "type": "object",
        "properties": {
          "min_cell_size": {
            "type": "integer"
          },
          "policy_reference": {
            "type": "string"
          },
          "cells": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Value"
            }
          },
          "suppressed_count": {
            "type": "integer"
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "ReportList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Report"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ReportDetail": {
        "type": "object",
        "properties": {
          "report": {
            "$ref": "#/components/schemas/Report"
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Value"
            }
          },
          "approvers": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "submissions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "Lineage": {
        "type": "object",
        "properties": {
          "report": {
            "$ref": "#/components/schemas/Report"
          },
          "indicators": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Indicator"
            }
          },
          "policy": {
            "type": "object"
          },
          "source_facilities": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "aggregation_method": {
            "type": "string"
          },
          "revisions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "decisions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "ValidateResult": {
        "type": "object",
        "properties": {
          "passed": {
            "type": "boolean"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          },
          "report": {
            "$ref": "#/components/schemas/Report"
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "ApproveResult": {
        "type": "object",
        "properties": {
          "report": {
            "$ref": "#/components/schemas/Report"
          },
          "approvals_recorded": {
            "type": "integer"
          },
          "approvals_required": {
            "type": "integer",
            "enum": [
              2
            ]
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "DecisionResult": {
        "type": "object",
        "properties": {
          "report": {
            "$ref": "#/components/schemas/Report"
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "SubmitResult": {
        "type": "object",
        "properties": {
          "report": {
            "$ref": "#/components/schemas/Report"
          },
          "submission": {
            "type": "object",
            "properties": {
              "attempt": {
                "type": "integer"
              },
              "receipt_ref": {
                "type": "string"
              },
              "outcome": {
                "type": "string",
                "enum": [
                  "acknowledged",
                  "rejected"
                ]
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "SubmissionList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Dashboard": {
        "type": "object",
        "properties": {
          "counts": {
            "type": "object"
          },
          "awaiting_correction": {
            "type": "integer"
          },
          "overdue": {
            "type": "integer"
          },
          "no_deadline_configured": {
            "type": "integer"
          }
        }
      },
      "DrainResult": {
        "type": "object",
        "properties": {
          "delivered": {
            "type": "integer"
          },
          "pending": {
            "type": "integer"
          }
        },
        "description": "The platform relay publishes events; this call never claims delivery."
      },
      "ReportCatalog": {
        "type": "object",
        "properties": {
          "reports": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "AnalyticReport": {
        "type": "object",
        "properties": {
          "report_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rows": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "summary": {
            "type": "object",
            "additionalProperties": true
          },
          "state": {
            "type": "string",
            "enum": [
              "rendered",
              "no_authorized_data"
            ]
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ExportReceipt": {
        "type": "object",
        "properties": {
          "export_id": {
            "type": "string",
            "format": "uuid"
          },
          "report_id": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "rows": {
            "type": "integer"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "single_use": {
            "type": "boolean"
          },
          "download_path": {
            "type": "string"
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "module": {
            "type": "string"
          },
          "dependencies": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "enum": [
                "synthetic",
                "unconfigured",
                "live"
              ]
            }
          }
        }
      }
    }
  }
}
