{
  "openapi": "3.1.0",
  "info": {
    "title": "OHN-44 Clinical Safety and Information Integrity",
    "version": "1.0.0",
    "description": "Server paths are under /api/ohn/v1/clinical-safety. Default deny: role AND purpose must match. Inventory paths OHN-44-API-001..003 are mapped to this disjoint prefix (see ADR-0001)."
  },
  "servers": [
    {
      "url": "/api/ohn/v1/clinical-safety"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/hazards": {
      "post": {
        "operationId": "registerHazard",
        "summary": "Register a clinical hazard (F001, W001)",
        "x-inventory-id": "OHN-44-API-001",
        "x-roles": [
          "clinical_safety_officer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HazardCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "get": {
        "operationId": "listHazards",
        "summary": "Clinical safety board",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "module",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^OHN-[0-9]{2}$"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/hazards/{id}": {
      "get": {
        "operationId": "getHazard",
        "summary": "Hazard case with requirements and evidence",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/hazards/{id}/transitions": {
      "post": {
        "operationId": "stepHazard",
        "summary": "Advance hazard management; residual-risk decisions by a reviewer who is not owner or registrant",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "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/HazardStepCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/hazards/{id}/requirements": {
      "post": {
        "operationId": "addRequirement",
        "summary": "Add a safety requirement (F002)",
        "x-roles": [
          "clinical_safety_officer"
        ],
        "x-purpose": "clinical_safety",
        "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/RequirementCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/requirements/{id}/evidence": {
      "post": {
        "operationId": "addEvidence",
        "summary": "Record a test result reviewed by a clinician other than the author",
        "x-roles": [
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "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/EvidenceCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/evidence": {
      "get": {
        "operationId": "listEvidence",
        "summary": "Safety evidence register",
        "x-inventory-id": "OHN-44-API-002",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "module",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^OHN-[0-9]{2}$"
            }
          },
          {
            "name": "hazard_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "release",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/incidents": {
      "post": {
        "operationId": "reportIncident",
        "summary": "Report a clinical safety incident (W002)",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncidentCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "get": {
        "operationId": "listIncidents",
        "summary": "Incidents",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "module",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^OHN-[0-9]{2}$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/incidents/{id}/transitions": {
      "post": {
        "operationId": "stepIncident",
        "summary": "Advance an incident; remediation verified by a reviewer who is not the reporter",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "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/IncidentStepCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/releases": {
      "post": {
        "operationId": "submitRelease",
        "summary": "Submit a build to the clinical release gate (W003)",
        "x-roles": [
          "clinical_safety_officer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseSubmitCommand"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "get": {
        "operationId": "listReleases",
        "summary": "Releases",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "module",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^OHN-[0-9]{2}$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/releases/{id}": {
      "get": {
        "operationId": "getRelease",
        "summary": "Release with blockers",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/releases/{id}/transitions": {
      "post": {
        "operationId": "stepRelease",
        "summary": "Check hazards (computes blockers) or send to clinical review",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "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/ReleaseStepCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/releases/{id}/approve": {
      "post": {
        "operationId": "decideRelease",
        "summary": "Approve or block a release (F003); approval with blockers is refused",
        "x-inventory-id": "OHN-44-API-003",
        "x-roles": [
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "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/ReleaseDecisionCommand"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/safety-case/{moduleId}": {
      "get": {
        "operationId": "exportSafetyCase",
        "summary": "Safety case for a module with a content digest",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "moduleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^OHN-[0-9]{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/code-lists/{list}": {
      "get": {
        "operationId": "getCodeList",
        "summary": "Controlled list (severity, likelihood, residual_risk)",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "list",
            "in": "path",
            "required": true,
            "schema": {
              "enum": [
                "severity",
                "likelihood",
                "residual_risk"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "operationId": "upsertCodeList",
        "summary": "Upsert controlled list entries",
        "x-roles": [
          "clinical_safety_officer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "list",
            "in": "path",
            "required": true,
            "schema": {
              "enum": [
                "severity",
                "likelihood",
                "residual_risk"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CodeListBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/policy": {
      "get": {
        "operationId": "getPolicy",
        "summary": "Release-blocking policy",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "post": {
        "operationId": "setPolicy",
        "summary": "Set the release-blocking policy",
        "x-roles": [
          "clinical_safety_officer"
        ],
        "x-purpose": "clinical_safety",
        "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/maintenance/drain-outbox": {
      "post": {
        "operationId": "drainOutbox",
        "summary": "Report pending outbox events (no sink: nothing claimed delivered)",
        "x-roles": [
          "clinical_safety_officer"
        ],
        "x-purpose": "clinical_safety",
        "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/report-catalog": {
      "get": {
        "operationId": "reportCatalog",
        "summary": "Available reports",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/reports/{reportId}": {
      "get": {
        "operationId": "runReport",
        "summary": "Run report R001..R003",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^OHN-44-R00[123]$"
            }
          },
          {
            "name": "module",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^OHN-[0-9]{2}$"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "release",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "jurisdiction",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            }
          },
          {
            "name": "period_from",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 10
            }
          },
          {
            "name": "period_to",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 10
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/reports/{reportId}/export": {
      "post": {
        "operationId": "exportReport",
        "summary": "Create a signed single-use report export",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "reportId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^OHN-44-R00[123]$"
            }
          },
          {
            "$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": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/report-exports/{token}": {
      "get": {
        "operationId": "downloadReportExport",
        "summary": "Download a report export once",
        "x-roles": [
          "clinical_safety_officer",
          "clinical_reviewer"
        ],
        "x-purpose": "clinical_safety",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{20,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing Idempotency-Key"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "403": {
            "description": "Role/purpose denied, separation of duties or role not permitted for the step"
          },
          "404": {
            "description": "Not found / not disclosed"
          },
          "409": {
            "description": "Version conflict, illegal transition, duplicate release 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)"
          }
        },
        "tags": [
          "OHN-44"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    }
  },
  "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": {
      "HazardCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "module_id",
          "hazard_description",
          "severity",
          "likelihood",
          "hazard_owner",
          "affected_user_story"
        ],
        "properties": {
          "module_id": {
            "type": "string",
            "pattern": "^OHN-[0-9]{2}$"
          },
          "hazard_description": {
            "type": "string",
            "minLength": 10,
            "maxLength": 4000
          },
          "severity": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "likelihood": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "hazard_owner": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          },
          "affected_user_story": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          }
        }
      },
      "HazardStepCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "to_state",
          "expected_version",
          "reason"
        ],
        "properties": {
          "to_state": {
            "type": "string",
            "enum": [
              "severity_assessed",
              "control_defined",
              "tested",
              "residual_risk_accepted_or_rejected"
            ]
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          },
          "severity": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "likelihood": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "residual_risk": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "decision": {
            "type": "string",
            "enum": [
              "accepted",
              "rejected"
            ]
          }
        }
      },
      "RequirementCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "mitigation_requirement",
          "residual_risk"
        ],
        "properties": {
          "mitigation_requirement": {
            "type": "string",
            "minLength": 10,
            "maxLength": 4000
          },
          "residual_risk": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          }
        }
      },
      "EvidenceCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "test_ref",
          "result"
        ],
        "properties": {
          "test_ref": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          },
          "result": {
            "type": "string",
            "enum": [
              "pass",
              "fail"
            ]
          },
          "release_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "IncidentCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "module_id",
          "description",
          "severity",
          "clinical_impact"
        ],
        "properties": {
          "module_id": {
            "type": "string",
            "pattern": "^OHN-[0-9]{2}$"
          },
          "hazard_id": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          },
          "description": {
            "type": "string",
            "minLength": 10,
            "maxLength": 4000
          },
          "severity": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "clinical_impact": {
            "type": "string",
            "minLength": 5,
            "maxLength": 2000
          }
        }
      },
      "IncidentStepCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "to_state",
          "expected_version",
          "reason"
        ],
        "properties": {
          "to_state": {
            "type": "string",
            "enum": [
              "clinical_triage",
              "containment",
              "root_cause",
              "verified_remediation"
            ]
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          },
          "containment": {
            "type": "string",
            "minLength": 10,
            "maxLength": 4000
          },
          "root_cause": {
            "type": "string",
            "minLength": 10,
            "maxLength": 4000
          },
          "remediation_ref": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          }
        }
      },
      "ReleaseSubmitCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "module_id",
          "release_ref"
        ],
        "properties": {
          "module_id": {
            "type": "string",
            "pattern": "^OHN-[0-9]{2}$"
          },
          "release_ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          }
        }
      },
      "ReleaseStepCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "to_state",
          "expected_version",
          "reason"
        ],
        "properties": {
          "to_state": {
            "type": "string",
            "enum": [
              "hazards_checked",
              "clinical_review"
            ]
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        }
      },
      "ReleaseDecisionCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "hazard_closure_evidence",
          "unresolved_issues",
          "clinical_signoff",
          "decision",
          "expected_version",
          "reason"
        ],
        "properties": {
          "hazard_closure_evidence": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          },
          "unresolved_issues": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4000
          },
          "clinical_signoff": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          },
          "decision": {
            "type": "string",
            "enum": [
              "approve",
              "block"
            ]
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000
          }
        }
      },
      "CodeListBody": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "entries"
        ],
        "properties": {
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "code": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "rank": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 1000
                },
                "active": {
                  "type": "boolean",
                  "default": true
                }
              },
              "required": [
                "code",
                "label",
                "rank"
              ]
            },
            "minItems": 1,
            "maxItems": 200
          }
        }
      },
      "PolicyCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "blocking_severities",
          "blocking_residual_risks",
          "approval_reference"
        ],
        "properties": {
          "blocking_severities": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            },
            "minItems": 1
          },
          "blocking_residual_risks": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            }
          },
          "approval_reference": {
            "type": "string",
            "minLength": 3,
            "maxLength": 256
          },
          "expected_version": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "ExportCommand": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "format"
        ],
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "csv",
              "pdf"
            ]
          },
          "filters": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "module": {
                "type": "string",
                "pattern": "^OHN-[0-9]{2}$"
              },
              "severity": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,63}$"
              },
              "release": {
                "type": "string",
                "minLength": 0,
                "maxLength": 128
              },
              "jurisdiction": {
                "type": "string",
                "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
              },
              "period_from": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "period_to": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "object"
          }
        }
      }
    }
  }
}
