{
  "openapi": "3.1.0",
  "info": {
    "title": "OHN-12 Immunization, Maternal and Child Summaries",
    "version": "1.0.0",
    "description": "Server paths are under /api/ohn/v1/child-health. Default deny: role AND purpose must match. Inventory paths OHN-12-API-001..002 are mapped to this disjoint prefix (see ADR-0001)."
  },
  "servers": [
    {
      "url": "/api/ohn/v1/child-health"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/patients/{id}/patient-view": {
      "get": {
        "operationId": "getPatientView",
        "summary": "The patient’s own visible immunizations and schedule status (OHN-31 patient chart)",
        "x-roles": [
          "patient"
        ],
        "x-purpose": "patient_access",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{id}/immunizations": {
      "get": {
        "operationId": "listPatientImmunizations",
        "summary": "Visible immunizations with schedule comparison",
        "x-inventory-id": "OHN-12-API-001",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{id}/maternal-child-summary": {
      "get": {
        "operationId": "getMaternalChildSummary",
        "summary": "Summary assembled with sensitive sections filtered (W002)",
        "x-inventory-id": "OHN-12-API-002",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{id}/timeline": {
      "get": {
        "operationId": "getTimeline",
        "summary": "Child care timeline",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{id}/confidentiality-preview": {
      "get": {
        "operationId": "previewConfidentiality",
        "summary": "What each requester kind would see",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/immunizations": {
      "post": {
        "operationId": "submitImmunization",
        "summary": "Submit a vaccine event (F001)",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImmunizationCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      },
      "get": {
        "operationId": "listImmunizations",
        "summary": "Pipeline worklist (not for guardian verifiers)",
        "x-roles": [
          "licensed_clinician",
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "vaccine_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "patient_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/immunizations/{id}/transitions": {
      "post": {
        "operationId": "transitionImmunization",
        "summary": "Advance vaccine event ingestion (W001)",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImmunizationStepCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/pregnancy-episodes": {
      "post": {
        "operationId": "recordPregnancy",
        "summary": "Record a pregnancy episode (F002)",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PregnancyCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/pregnancy-episodes/{id}/close": {
      "post": {
        "operationId": "closePregnancy",
        "summary": "Close a pregnancy episode",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PregnancyCloseCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/birth-events": {
      "post": {
        "operationId": "submitBirth",
        "summary": "Associate a newborn with a mother (F003)",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BirthCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      },
      "get": {
        "operationId": "listBirths",
        "summary": "Birth links",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier",
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "child",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "mother",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/birth-events/{id}/decision": {
      "post": {
        "operationId": "decideBirth",
        "summary": "Verify or dispute a birth link",
        "x-roles": [
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BirthDecisionCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/age-transitions": {
      "post": {
        "operationId": "openTransition",
        "summary": "Open an age-threshold transition case",
        "x-roles": [
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionOpenCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      },
      "get": {
        "operationId": "listTransitions",
        "summary": "Transition cases",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier",
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/age-transitions/{id}/transitions": {
      "post": {
        "operationId": "stepTransition",
        "summary": "Advance a transition (W003)",
        "x-roles": [
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionStepCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/schedule": {
      "get": {
        "operationId": "getSchedule",
        "summary": "Jurisdiction vaccination schedule",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier",
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      },
      "post": {
        "operationId": "upsertSchedule",
        "summary": "Upsert a schedule entry",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleEntryCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/policy": {
      "get": {
        "operationId": "getPolicy",
        "summary": "Age-threshold policy",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier",
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      },
      "post": {
        "operationId": "setPolicy",
        "summary": "Set the age-threshold policy",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/maintenance/drain-outbox": {
      "post": {
        "operationId": "drainOutbox",
        "summary": "Report pending outbox events (no sink: nothing claimed delivered)",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/report-catalog": {
      "get": {
        "operationId": "reportCatalog",
        "summary": "Available reports",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier",
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/reports/{reportId}": {
      "get": {
        "operationId": "runReport",
        "summary": "Run report R001..R004",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier",
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "OHN-12-R001",
                "OHN-12-R002",
                "OHN-12-R003",
                "OHN-12-R004"
              ]
            }
          },
          {
            "name": "facility",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vaccine_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "name": "birth_year",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}$"
            }
          },
          {
            "name": "jurisdiction",
            "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}$"
            }
          },
          {
            "name": "period_to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/reports/{reportId}/export": {
      "post": {
        "operationId": "exportReport",
        "summary": "Create a signed single-use export",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "OHN-12-R001",
                "OHN-12-R002",
                "OHN-12-R003",
                "OHN-12-R004"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExportCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/exports/{token}": {
      "get": {
        "operationId": "downloadExport",
        "summary": "Download an export once",
        "x-roles": [
          "licensed_clinician",
          "guardian_verifier"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{20,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/config": {
      "get": {
        "operationId": "getAncConfig",
        "summary": "Active antenatal configuration (or configured=false)",
        "x-roles": [
          "licensed_clinician",
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/config-versions": {
      "get": {
        "operationId": "listAncConfigs",
        "summary": "Antenatal configuration versions",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      },
      "post": {
        "operationId": "draftAncConfig",
        "summary": "Draft an antenatal configuration",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AncConfigDraftCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/config-versions/demo": {
      "post": {
        "operationId": "loadDemoAncConfig",
        "summary": "Draft the SYNTHETIC demo configuration (404 in production)",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/config-versions/reference": {
      "post": {
        "operationId": "loadReferenceAncConfig",
        "summary": "Draft the reference configuration (WHO 2016 antenatal care model with eight contacts at 12, 20, 26, 30, 34, 36, 38 and 40 weeks; WHO IMPAC PCPNC 2015 danger signs; each item cited) with synthetic_demo false. Served in every profile; it counts only after a second person approves it with a real approval reference",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/config-versions/{id}/submit": {
      "post": {
        "operationId": "submitAncConfig",
        "summary": "Submit a draft for approval",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AncConfigSubmitCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/config-versions/{id}/approve": {
      "post": {
        "operationId": "approveAncConfig",
        "summary": "Approve and activate (a second person)",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AncConfigApproveCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/config-versions/{id}/reject": {
      "post": {
        "operationId": "rejectAncConfig",
        "summary": "Reject a configuration",
        "x-roles": [
          "immunization_steward"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AncConfigRejectCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/episodes": {
      "get": {
        "operationId": "listAncEpisodes",
        "summary": "Antenatal worklist (facility, state, mother)",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "delivered",
                "closed"
              ]
            }
          },
          {
            "name": "facility",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "mother",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      },
      "post": {
        "operationId": "startAncEpisode",
        "summary": "Start antenatal care (creates the PregnancyEpisode)",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AncStartCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/episodes/{id}": {
      "get": {
        "operationId": "getAncEpisode",
        "summary": "Antenatal episode with schedule, contacts, scans, delivery",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/episodes/{id}/contacts": {
      "post": {
        "operationId": "recordAncContact",
        "summary": "Record an antenatal contact",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AncContactCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/episodes/{id}/contacts/{cid}/entered-in-error": {
      "post": {
        "operationId": "ancContactInError",
        "summary": "Mark a contact entered in error",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnteredInErrorCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/episodes/{id}/ultrasounds": {
      "post": {
        "operationId": "recordUltrasound",
        "summary": "Record an ultrasound summary",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UltrasoundCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/episodes/{id}/ultrasounds/{uid}/entered-in-error": {
      "post": {
        "operationId": "ultrasoundInError",
        "summary": "Mark an ultrasound entered in error",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "uid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnteredInErrorCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/episodes/{id}/plan": {
      "post": {
        "operationId": "updateAncPlan",
        "summary": "Risk factors and birth plan",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/anc/episodes/{id}/delivery": {
      "post": {
        "operationId": "recordDelivery",
        "summary": "Delivery outcome: BirthEvent + birth summary per baby",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliveryCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{patientId}/anc": {
      "get": {
        "operationId": "listMotherAncEpisodes",
        "summary": "Antenatal episodes of a mother (patient chart)",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "patientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{patientId}/birth-summary": {
      "get": {
        "operationId": "getBirthSummary",
        "summary": "Child’s pregnancy-and-birth summary (clinician)",
        "x-roles": [
          "licensed_clinician"
        ],
        "x-purpose": "immunization_maternal_child",
        "parameters": [
          {
            "name": "patientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{patientId}/pregnancy-view": {
      "get": {
        "operationId": "getPregnancyView",
        "summary": "My pregnancy (mother, or a representative she delegated in OHN-19)",
        "x-roles": [
          "patient"
        ],
        "x-purpose": "patient_access",
        "parameters": [
          {
            "name": "patientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{patientId}/children": {
      "get": {
        "operationId": "getMyChildren",
        "summary": "My babies’ birth summaries and my sharing choices (mother only)",
        "x-roles": [
          "patient"
        ],
        "x-purpose": "patient_access",
        "parameters": [
          {
            "name": "patientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    },
    "/patients/{patientId}/birth-summary-view": {
      "get": {
        "operationId": "getBirthSummaryView",
        "summary": "Birth summary for the child or a guardian in force (OHN-19)",
        "x-roles": [
          "patient"
        ],
        "x-purpose": "patient_access",
        "parameters": [
          {
            "name": "patientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Denied by policy"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition or idempotency mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Domain validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited"
          },
          "503": {
            "description": "Dependency unavailable (fail closed)"
          }
        }
      }
    }
  },
  "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": {
      "ImmunizationCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "patient_id": {
            "type": "string",
            "format": "uuid"
          },
          "code_system": {
            "type": "string",
            "enum": [
              "cvx",
              "snomed_ct",
              "atc",
              "local"
            ]
          },
          "vaccine_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "administered_at": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "dose_number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "lot_number": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9._/-]+$"
          },
          "source_facility": {
            "type": "string",
            "format": "uuid"
          },
          "source_event_id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "not_done",
              "entered_in_error"
            ]
          }
        },
        "required": [
          "patient_id",
          "code_system",
          "vaccine_code",
          "administered_at",
          "source_facility",
          "source_event_id",
          "status"
        ]
      },
      "ImmunizationStepCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "to_state": {
            "type": "string",
            "enum": [
              "terminology_checked",
              "identity_linked",
              "versioned",
              "visible",
              "rejected"
            ]
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "to_state",
          "expected_version",
          "reason"
        ]
      },
      "PregnancyCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mother_patient_ref": {
            "type": "string",
            "format": "uuid"
          },
          "pregnancy_episode_ref": {
            "type": "string",
            "format": "uuid"
          },
          "care_facility": {
            "type": "string",
            "format": "uuid"
          },
          "episode_start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "estimated_delivery_date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        },
        "required": [
          "mother_patient_ref",
          "pregnancy_episode_ref",
          "care_facility",
          "episode_start"
        ]
      },
      "PregnancyCloseCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "expected_version",
          "reason"
        ]
      },
      "BirthCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "child_health_id": {
            "type": "string",
            "format": "uuid"
          },
          "mother_health_id": {
            "type": "string",
            "format": "uuid"
          },
          "birth_event_ref": {
            "type": "string",
            "format": "uuid"
          },
          "multiple_birth_order": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "relationship_evidence": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "child_health_id",
          "mother_health_id",
          "birth_event_ref",
          "relationship_evidence"
        ]
      },
      "BirthDecisionCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "verified",
              "disputed"
            ]
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "decision",
          "expected_version",
          "reason"
        ]
      },
      "TransitionOpenCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "patient_id": {
            "type": "string",
            "format": "uuid"
          },
          "date_of_birth": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        },
        "required": [
          "patient_id",
          "date_of_birth"
        ]
      },
      "TransitionStepCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "to_state": {
            "type": "string",
            "enum": [
              "jurisdiction_policy_evaluated",
              "delegations_adjusted",
              "notified"
            ]
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "to_state",
          "expected_version",
          "reason"
        ]
      },
      "ScheduleEntryCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "vaccine_code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "expected_doses": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "approval_reference": {
            "type": "string",
            "minLength": 3,
            "maxLength": 256
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "vaccine_code",
          "expected_doses",
          "approval_reference"
        ]
      },
      "PolicyCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "transition_age_years": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30
          },
          "transition_action": {
            "type": "string",
            "enum": [
              "revoke_guardian_access",
              "require_reconsent"
            ]
          },
          "approval_reference": {
            "type": "string",
            "minLength": 3,
            "maxLength": 256
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "transition_age_years",
          "transition_action",
          "approval_reference"
        ]
      },
      "ExportCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "csv",
              "pdf"
            ]
          },
          "filters": {
            "type": "object",
            "description": "Report filters (facility, vaccine_code, status, birth_year, jurisdiction, period_from, period_to); unknown keys and invalid values are refused with 422"
          }
        },
        "required": [
          "format"
        ]
      },
      "AncConfigDraftCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "document": {
            "type": "object",
            "description": "Jurisdiction antenatal configuration (clinical content). Strict document, validated by the application (all keys listed here, unknown keys refused with 422): label, notice, dating{edd_offset_days 200..320, max_gestation_weeks 30..50}, contact_schedule[], danger_signs[], risk_factors[], tests[], supplements[], delivery_modes[], birth_summary{standard_facts, fields[], prenatal_findings always|never}, representation{child_summary_category, pregnancy_category}. Every label has en and fr."
          }
        },
        "required": [
          "document"
        ]
      },
      "AncConfigSubmitCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "expected_version"
        ]
      },
      "AncConfigApproveCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "approval_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "expected_version",
          "approval_ref"
        ]
      },
      "AncConfigRejectCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "expected_version",
          "reason"
        ]
      },
      "AncStartCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mother_patient_ref": {
            "type": "string",
            "format": "uuid"
          },
          "care_facility": {
            "type": "string",
            "format": "uuid"
          },
          "dating_method": {
            "type": "string",
            "enum": [
              "lmp",
              "ultrasound"
            ]
          },
          "lmp": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "dating_scan_date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "dating_scan_ga_weeks": {
            "type": "integer",
            "minimum": 4,
            "maximum": 30
          },
          "dating_scan_ga_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 6
          },
          "gravida": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30
          },
          "para": {
            "type": "integer",
            "minimum": 0,
            "maximum": 30
          }
        },
        "required": [
          "mother_patient_ref",
          "care_facility",
          "dating_method",
          "gravida",
          "para"
        ]
      },
      "AncContactCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "contact_date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "facility": {
            "type": "string",
            "format": "uuid"
          },
          "schedule_key": {
            "type": "string"
          },
          "bp_systolic": {
            "type": "integer",
            "minimum": 40,
            "maximum": 300
          },
          "bp_diastolic": {
            "type": "integer",
            "minimum": 20,
            "maximum": 200
          },
          "weight_kg": {
            "type": "number",
            "minimum": 20,
            "maximum": 300
          },
          "fundal_height_cm": {
            "type": "number",
            "minimum": 0,
            "maximum": 60
          },
          "fetal_heart_rate_bpm": {
            "type": "integer",
            "minimum": 50,
            "maximum": 250
          },
          "presentation": {
            "type": "string",
            "enum": [
              "cephalic",
              "breech",
              "transverse",
              "oblique",
              "not_determined"
            ]
          },
          "tests": {
            "type": "array",
            "maxItems": 30,
            "items": {
              "$ref": "#/components/schemas/TestEntry"
            }
          },
          "supplements": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 20
          },
          "immunization_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 10
          },
          "danger_signs_reported": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 20
          },
          "note": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "expected_version",
          "contact_date",
          "facility"
        ]
      },
      "EnteredInErrorCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        },
        "required": [
          "expected_version",
          "reason"
        ]
      },
      "UltrasoundCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "scan_date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "facility": {
            "type": "string",
            "format": "uuid"
          },
          "number_of_fetuses": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "findings": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "relevant_to_child": {
            "type": "boolean"
          },
          "child_relevant_summary": {
            "type": "string",
            "maxLength": 1000
          },
          "report_ref": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "expected_version",
          "scan_date",
          "facility",
          "number_of_fetuses",
          "findings"
        ]
      },
      "PlanCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "risk_factors": {
            "type": "array",
            "maxItems": 40,
            "items": {
              "$ref": "#/components/schemas/RiskFactorInput"
            }
          },
          "birth_plan": {
            "type": "object",
            "description": "planned_place (uuid or null), companion (max 200), transport (max 300), preferences (max 2000); unknown keys refused with 422"
          }
        },
        "required": [
          "expected_version",
          "risk_factors",
          "birth_plan"
        ]
      },
      "DeliveryCommand": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "delivery_date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "mode": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,48}$"
          },
          "place_facility": {
            "type": "string",
            "format": "uuid"
          },
          "babies": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/BabyInput"
            }
          },
          "note": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "required": [
          "expected_version",
          "delivery_date",
          "mode",
          "place_facility",
          "babies"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "error"
        ]
      },
      "TestEntry": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,48}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "ordered",
              "resulted",
              "declined",
              "not_available"
            ]
          },
          "order_ref": {
            "type": "string",
            "format": "uuid"
          },
          "result_ref": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "key",
          "status"
        ]
      },
      "RiskFactorInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,48}$"
          },
          "note": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "key"
        ]
      },
      "BabyInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "child_health_id": {
            "type": "string",
            "format": "uuid"
          },
          "birth_order": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8
          },
          "fields": {
            "type": "object",
            "description": "Values of the configured birth-summary fields (key -> number, string up to 500, boolean or list of keys); validated against the active antenatal configuration, unknown keys and out-of-range values are refused with 422"
          }
        },
        "required": [
          "child_health_id"
        ]
      },
      "AncConfigDocument": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "label": {
            "type": "string"
          },
          "notice": {
            "type": "string"
          },
          "dating": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "edd_offset_days": {
                "type": "integer"
              },
              "max_gestation_weeks": {
                "type": "integer"
              }
            },
            "required": [
              "edd_offset_days",
              "max_gestation_weeks"
            ]
          },
          "contact_schedule": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "en": {
                      "type": "string"
                    },
                    "fr": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "en",
                    "fr"
                  ]
                },
                "target_week": {
                  "type": "integer"
                },
                "window_start_week": {
                  "type": "integer"
                },
                "window_end_week": {
                  "type": "integer"
                }
              },
              "required": [
                "key",
                "label",
                "target_week",
                "window_start_week",
                "window_end_week"
              ]
            }
          },
          "danger_signs": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "en": {
                      "type": "string"
                    },
                    "fr": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "en",
                    "fr"
                  ]
                },
                "guidance": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "en": {
                      "type": "string"
                    },
                    "fr": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "en",
                    "fr"
                  ]
                },
                "urgency": {
                  "type": "string",
                  "enum": [
                    "seek_care_now",
                    "seek_care_today"
                  ]
                }
              },
              "required": [
                "key",
                "label",
                "guidance",
                "urgency"
              ]
            }
          },
          "risk_factors": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "en": {
                      "type": "string"
                    },
                    "fr": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "en",
                    "fr"
                  ]
                }
              },
              "required": [
                "key",
                "label"
              ]
            }
          },
          "tests": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "en": {
                      "type": "string"
                    },
                    "fr": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "en",
                    "fr"
                  ]
                }
              },
              "required": [
                "key",
                "label"
              ]
            }
          },
          "supplements": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "en": {
                      "type": "string"
                    },
                    "fr": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "en",
                    "fr"
                  ]
                }
              },
              "required": [
                "key",
                "label"
              ]
            }
          },
          "delivery_modes": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "en": {
                      "type": "string"
                    },
                    "fr": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "en",
                    "fr"
                  ]
                }
              },
              "required": [
                "key",
                "label"
              ]
            }
          },
          "birth_summary": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "standard_facts": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "gestational_age_at_birth": {
                    "type": "boolean"
                  },
                  "mode_of_delivery": {
                    "type": "boolean"
                  },
                  "plurality": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "gestational_age_at_birth",
                  "mode_of_delivery",
                  "plurality"
                ]
              },
              "fields": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "label": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "en": {
                          "type": "string"
                        },
                        "fr": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "en",
                        "fr"
                      ]
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "number",
                        "integer",
                        "choice",
                        "multi_choice",
                        "boolean",
                        "text"
                      ]
                    },
                    "unit": {
                      "type": "string"
                    },
                    "min": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                          "value": {
                            "type": "string"
                          },
                          "label": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                              "en": {
                                "type": "string"
                              },
                              "fr": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "en",
                              "fr"
                            ]
                          }
                        },
                        "required": [
                          "value",
                          "label"
                        ]
                      }
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "maternal_sensitive": {
                      "type": "boolean"
                    },
                    "sharing": {
                      "type": "string",
                      "enum": [
                        "always",
                        "with_mother_consent",
                        "never"
                      ]
                    },
                    "consent_resource_class": {}
                  },
                  "required": [
                    "key",
                    "label",
                    "kind",
                    "sharing"
                  ]
                }
              },
              "prenatal_findings": {
                "type": "string",
                "enum": [
                  "always",
                  "never"
                ]
              }
            },
            "required": [
              "standard_facts",
              "fields",
              "prenatal_findings"
            ]
          },
          "representation": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "child_summary_category": {},
              "pregnancy_category": {}
            },
            "required": [
              "child_summary_category",
              "pregnancy_category"
            ]
          }
        },
        "required": [
          "label",
          "notice",
          "dating",
          "contact_schedule",
          "danger_signs",
          "risk_factors",
          "tests",
          "supplements",
          "delivery_modes",
          "birth_summary",
          "representation"
        ],
        "description": "Jurisdiction antenatal configuration (clinical content). Strict document, validated by the application (all keys listed here, unknown keys refused with 422): label, notice, dating{edd_offset_days 200..320, max_gestation_weeks 30..50}, contact_schedule[], danger_signs[], risk_factors[], tests[], supplements[], delivery_modes[], birth_summary{standard_facts, fields[], prenatal_findings always|never}, representation{child_summary_category, pregnancy_category}. Every label has en and fr."
      }
    }
  }
}
