{
  "openapi": "3.0.1",
  "info": {
    "title": "Regional Sync Service API",
    "description": "Regional orchestration seam for cohort read models,\ncontract-aware profile projection, and delivery intent.\n\nThis slice owns:\n- cohort read models over DQM-owned APIs\n- enriched cohort-member summaries\n- patient drill-down over the canonical regional profile\n- client-contract CRUD with relational authoritative persistence\n- privacy-mode projection preview using regional-sync-projection-policy-v1\n- delivery-ledger preparation and listing for cohort-driven delivery intent\n- queue, requeue, and replay-triggered publish kickoff into the configured lakehouse seam\n- publish-status refresh and receipt validation against the latest persisted run ids\n- internal replay requests, actor-aware audit events, and evidence export over the delivery ledger\n- delivery gating metadata for DQM-style completeness/freshness and MPI-style identity trust checks\n- operator-safe exception queue metadata with deep-link routes into DQM and MPI workflows\n\nThis slice does not yet own:\n- separated publish-attempt history beyond the latest delivery-row execution record\n- normalized callback/event ingestion beyond the current receipt endpoint\n- environment-backed proof for the live publish seam\n- delivery-keyed write-back into external DQM or MPI governance systems\n",
    "contact": {
      "name": "HealthData-in-Motion",
      "email": "support@healthdata-in-motion.com"
    },
    "version": "1.3.1"
  },
  "security": [
    {
      "bearer-jwt": []
    }
  ],
  "tags": [
    {
      "name": "Regional Sync",
      "description": "Regional orchestration seam for cohort, member, and patient read models."
    }
  ],
  "paths": {
    "/api/v1/regional-sync/contracts/{contractId}": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Get one client contract",
        "operationId": "getContract",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncClientContractResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Update a client contract",
        "operationId": "updateContract",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncClientContractUpsertRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncClientContractResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "List client contracts owned by regional sync",
        "operationId": "listContracts",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RegionalSyncClientContractResponse"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Create a client contract",
        "operationId": "createContract",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncClientContractUpsertRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncClientContractResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/requeue": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Requeue a delivery-ledger entry for downstream coordination",
        "operationId": "requeueDelivery",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncDeliveryActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/replay": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Record a replay request against the current internal delivery snapshot",
        "operationId": "replayDelivery",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncDeliveryActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/receipt": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Record downstream delivery receipt for one delivery-ledger entry",
        "operationId": "recordDeliveryReceipt",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncDeliveryReceiptRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/queue": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Queue a prepared delivery-ledger entry for downstream coordination",
        "operationId": "queueDelivery",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncDeliveryActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/publish/refresh": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Refresh downstream publish status for one delivery-ledger entry",
        "operationId": "refreshDeliveryPublishExecution",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncDeliveryActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/acknowledge": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Record acknowledgement for a delivery-ledger entry",
        "operationId": "acknowledgeDelivery",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncDeliveryActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/prepare": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Prepare delivery-ledger entries for one contract and cohort run",
        "operationId": "prepareDeliveries",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncDeliveryPreparationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryPreparationResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/prepare/token-gated": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Prepare delivery-ledger entries gated by a validated SP-4 subscription token",
        "operationId": "prepareDeliveriesTokenGated",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Subscription-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegionalSyncDeliveryPreparationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryPreparationResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/subscription-tokens": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Mint an SP-4 subscription token wrapping a contract (token returned once)",
        "operationId": "mintSubscriptionToken",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MintSubscriptionTokenRequest"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MintSubscriptionTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/subscription-tokens/{jti}": {
      "delete": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Revoke an SP-4 subscription token wrapping a contract (idempotent)",
        "operationId": "revokeSubscriptionToken",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "jti",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          }
        }
      }
    },
    "/api/v1/regional-sync/consent-reporting/readiness/project": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Publish aggregate consent warehouse readiness to the Atlas operator-safe async outbox",
        "operationId": "publishConsentWarehouseReadinessProjection",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "approvedUseCaseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "siteId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "regionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hieId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "consentCategory",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "correlationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncAsyncOutboxRecord"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/consent-reporting/events/consent-curated": {
      "post": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Ingest an operator-safe consent curation summary event for regional reporting",
        "operationId": "ingestConsentCurationEvent",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonNode"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncConsentCurationRecord"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/patients/{patientId}": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Get a regional patient drill-down with optional cohort overlay",
        "operationId": "getPatient",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "patientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cohortId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncPatientResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/exceptions": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "List Regional Sync delivery exceptions derived from DQM and MPI gating metadata",
        "operationId": "listExceptions",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cohortId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "patientId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "domain",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DQM",
                "MPI"
              ]
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BLOCKING",
                "WARNING"
              ]
            }
          },
          {
            "name": "gateStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "READY",
                "WARNING",
                "BLOCKED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RegionalSyncDeliveryExceptionResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/status": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Get one per-client delivery status summary",
        "operationId": "getContractStatus",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncContractStatusResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/projection/patients/{patientId}": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Preview one patient profile projected for a client contract",
        "operationId": "getProjectionPreview",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "patientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "privacyMode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "IDENTIFIED",
                "LIMITED",
                "DE_IDENTIFIED",
                "PSEUDONYMIZED"
              ]
            }
          },
          {
            "name": "cohortId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncProjectionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "List delivery-ledger entries for a client contract",
        "operationId": "listDeliveries",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cohortId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "patientId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PREPARED",
                "QUEUED",
                "PUBLISHED",
                "FAILED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Get one delivery-ledger entry for a client contract",
        "operationId": "getDelivery",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/publish": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Get persisted publish execution metadata for one delivery-ledger entry",
        "operationId": "getDeliveryPublishExecution",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncPublishExecutionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/evidence": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Get one internal evidence package for a delivery-ledger entry",
        "operationId": "getDeliveryEvidence",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryEvidenceResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/{deliveryId}/audit": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "List audit events recorded for one delivery-ledger entry",
        "operationId": "listDeliveryAuditEvents",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RegionalSyncDeliveryAuditEventResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/{contractId}/deliveries/export": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Export internal delivery evidence for a client contract",
        "operationId": "exportDeliveryEvidence",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contractId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cohortId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "patientId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PREPARED",
                "QUEUED",
                "PUBLISHED",
                "FAILED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncDeliveryEvidenceExportResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/contracts/status": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "List per-client delivery status summaries",
        "operationId": "listContractStatuses",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RegionalSyncContractStatusResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/consent-reporting/warehouse": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Project de-identified consent warehouse counts for regional reporting",
        "operationId": "getConsentWarehouseProjection",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "approvedUseCaseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "siteId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "regionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hieId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "consentCategory",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeSuppressedRecords",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncConsentWarehouseProjectionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/consent-reporting/readiness": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Project aggregate consent warehouse readiness for regional reporting",
        "operationId": "getConsentWarehouseReadiness",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "approvedUseCaseId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "siteId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "programId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "regionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hieId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "consentCategory",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncConsentWarehouseReadinessResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/cohorts": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "List regional cohorts through the orchestration seam",
        "operationId": "listCohorts",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RegionalSyncCohortDefinitionResponse"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/cohorts/{cohortId}": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Get one regional cohort with latest run context",
        "operationId": "getCohort",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cohortId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncCohortDetailResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/cohorts/{cohortId}/members": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "List enriched cohort members",
        "operationId": "listMembers",
        "parameters": [
          {
            "name": "X-Tenant-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cohortId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "runId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncMembersResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/regional-sync/capabilities": {
      "get": {
        "tags": [
          "Regional Sync"
        ],
        "summary": "Get current regional sync orchestration capabilities",
        "operationId": "getCapabilities",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionalSyncCapabilitiesResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RegionalSyncClientContractUpsertRequest": {
        "type": "object",
        "properties": {
          "clientId": {
            "type": "string"
          },
          "clientName": {
            "type": "string"
          },
          "subscribedCohortIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "allowedDataClasses": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTITY",
                "DEMOGRAPHICS",
                "COVERAGE",
                "COMPLETENESS",
                "PROVENANCE",
                "COHORT_MEMBERSHIP",
                "LOCATION"
              ]
            }
          },
          "allowedPrivacyModes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTIFIED",
                "LIMITED",
                "DE_IDENTIFIED",
                "PSEUDONYMIZED"
              ]
            }
          },
          "defaultPrivacyMode": {
            "type": "string",
            "enum": [
              "IDENTIFIED",
              "LIMITED",
              "DE_IDENTIFIED",
              "PSEUDONYMIZED"
            ]
          },
          "deliveryMechanism": {
            "type": "string"
          },
          "syncCadence": {
            "type": "string"
          },
          "requiredAcknowledgements": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "escalationRules": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean"
          }
        }
      },
      "RegionalSyncClientContractResponse": {
        "type": "object",
        "properties": {
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "tenantId": {
            "type": "string"
          },
          "clientId": {
            "type": "string"
          },
          "clientName": {
            "type": "string"
          },
          "subscribedCohortIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "allowedDataClasses": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTITY",
                "DEMOGRAPHICS",
                "COVERAGE",
                "COMPLETENESS",
                "PROVENANCE",
                "COHORT_MEMBERSHIP",
                "LOCATION"
              ]
            }
          },
          "allowedPrivacyModes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTIFIED",
                "LIMITED",
                "DE_IDENTIFIED",
                "PSEUDONYMIZED"
              ]
            }
          },
          "defaultPrivacyMode": {
            "type": "string",
            "enum": [
              "IDENTIFIED",
              "LIMITED",
              "DE_IDENTIFIED",
              "PSEUDONYMIZED"
            ]
          },
          "projectionPolicyVersion": {
            "type": "string"
          },
          "deliveryMechanism": {
            "type": "string"
          },
          "syncCadence": {
            "type": "string"
          },
          "requiredAcknowledgements": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "escalationRules": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "active": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncDeliveryActionRequest": {
        "type": "object",
        "properties": {
          "actorType": {
            "type": "string",
            "enum": [
              "SYSTEM",
              "OPERATOR",
              "DOWNSTREAM_SYSTEM"
            ]
          },
          "actorId": {
            "type": "string"
          },
          "actorDisplay": {
            "type": "string"
          },
          "evidenceReference": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "RegionalSyncDeliveryIssueResponse": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string",
            "enum": [
              "DQM",
              "MPI"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "BLOCKING",
              "WARNING"
            ]
          },
          "code": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "workflowRoute": {
            "type": "string"
          },
          "affectedDataClasses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncDeliveryLedgerEntryResponse": {
        "type": "object",
        "properties": {
          "deliveryId": {
            "type": "string",
            "format": "uuid"
          },
          "tenantId": {
            "type": "string"
          },
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "clientId": {
            "type": "string"
          },
          "clientName": {
            "type": "string"
          },
          "cohortId": {
            "type": "string",
            "format": "uuid"
          },
          "runId": {
            "type": "string",
            "format": "uuid"
          },
          "patientId": {
            "type": "string",
            "format": "uuid"
          },
          "patientName": {
            "type": "string"
          },
          "privacyMode": {
            "type": "string",
            "enum": [
              "IDENTIFIED",
              "LIMITED",
              "DE_IDENTIFIED",
              "PSEUDONYMIZED"
            ]
          },
          "projectionPolicyVersion": {
            "type": "string"
          },
          "deliveryMechanism": {
            "type": "string"
          },
          "payloadVersion": {
            "type": "string"
          },
          "sourceWatermark": {
            "type": "string",
            "format": "date-time"
          },
          "projectionChecksum": {
            "type": "string"
          },
          "includedFieldGroups": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTITY",
                "DEMOGRAPHICS",
                "COVERAGE",
                "COMPLETENESS",
                "PROVENANCE",
                "COHORT_MEMBERSHIP",
                "LOCATION"
              ]
            }
          },
          "suppressedPaths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "transformedPaths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "PREPARED",
              "QUEUED",
              "PUBLISHED",
              "FAILED"
            ]
          },
          "acknowledgementStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "ACKNOWLEDGED"
            ]
          },
          "gateStatus": {
            "type": "string",
            "enum": [
              "READY",
              "WARNING",
              "BLOCKED"
            ]
          },
          "gateIssues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionalSyncDeliveryIssueResponse"
            }
          },
          "preparedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "publishExecution": {
            "$ref": "#/components/schemas/RegionalSyncPublishExecutionResponse"
          }
        }
      },
      "RegionalSyncPublishExecutionResponse": {
        "type": "object",
        "properties": {
          "exportJobId": {
            "type": "string"
          },
          "packageId": {
            "type": "string"
          },
          "controlPlanePublishRunId": {
            "type": "string"
          },
          "edgeRunId": {
            "type": "string"
          },
          "targetType": {
            "type": "string"
          },
          "publishStatus": {
            "type": "string"
          },
          "ingestStatus": {
            "type": "string"
          },
          "outcomeCategory": {
            "type": "string"
          },
          "targetNamespace": {
            "type": "string"
          },
          "triggerType": {
            "type": "string"
          },
          "externalRunId": {
            "type": "string"
          },
          "artifactDestinations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncDeliveryReceiptRequest": {
        "type": "object",
        "properties": {
          "actorType": {
            "type": "string",
            "enum": [
              "SYSTEM",
              "OPERATOR",
              "DOWNSTREAM_SYSTEM"
            ]
          },
          "actorId": {
            "type": "string"
          },
          "actorDisplay": {
            "type": "string"
          },
          "evidenceReference": {
            "type": "string"
          },
          "note": {
            "type": "string"
          },
          "edgeRunId": {
            "type": "string"
          },
          "externalRunId": {
            "type": "string"
          }
        }
      },
      "RegionalSyncDeliveryPreparationRequest": {
        "type": "object",
        "properties": {
          "cohortId": {
            "type": "string",
            "format": "uuid"
          },
          "runId": {
            "type": "string",
            "format": "uuid"
          },
          "privacyMode": {
            "type": "string",
            "enum": [
              "IDENTIFIED",
              "LIMITED",
              "DE_IDENTIFIED",
              "PSEUDONYMIZED"
            ]
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "size": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "RegionalSyncDeliveryPreparationResponse": {
        "type": "object",
        "properties": {
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "cohortId": {
            "type": "string",
            "format": "uuid"
          },
          "runId": {
            "type": "string",
            "format": "uuid"
          },
          "privacyMode": {
            "type": "string",
            "enum": [
              "IDENTIFIED",
              "LIMITED",
              "DE_IDENTIFIED",
              "PSEUDONYMIZED"
            ]
          },
          "preparedCount": {
            "type": "integer",
            "format": "int32"
          },
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MintSubscriptionTokenRequest": {
        "type": "object",
        "properties": {
          "grantedDataClasses": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTITY",
                "DEMOGRAPHICS",
                "COVERAGE",
                "COMPLETENESS",
                "PROVENANCE",
                "COHORT_MEMBERSHIP",
                "LOCATION"
              ]
            }
          },
          "grantedPrivacyModes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTIFIED",
                "LIMITED",
                "DE_IDENTIFIED",
                "PSEUDONYMIZED"
              ]
            }
          },
          "cohortIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "ttl": {
            "type": "string"
          }
        }
      },
      "MintSubscriptionTokenResponse": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          },
          "jti": {
            "type": "string",
            "format": "uuid"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "tenantId": {
            "type": "string"
          },
          "grantedDataClasses": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTITY",
                "DEMOGRAPHICS",
                "COVERAGE",
                "COMPLETENESS",
                "PROVENANCE",
                "COHORT_MEMBERSHIP",
                "LOCATION"
              ]
            }
          },
          "grantedPrivacyModes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTIFIED",
                "LIMITED",
                "DE_IDENTIFIED",
                "PSEUDONYMIZED"
              ]
            }
          }
        }
      },
      "RegionalSyncAsyncHandoffEvent": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "environmentId": {
            "type": "string"
          },
          "laneOwner": {
            "type": "string"
          },
          "approvedUseCaseId": {
            "type": "string"
          },
          "sourceEventType": {
            "type": "string"
          },
          "sourceEventId": {
            "type": "string"
          },
          "correlationId": {
            "type": "string"
          },
          "handoffMode": {
            "type": "string"
          },
          "privacyBoundary": {
            "type": "string"
          },
          "dataClass": {
            "type": "string"
          },
          "attempt": {
            "type": "integer",
            "format": "int32"
          },
          "maxAttempts": {
            "type": "integer",
            "format": "int32"
          },
          "emittedAt": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "type": "object",
            "additionalProperties": {
              "type": "object"
            }
          }
        }
      },
      "RegionalSyncAsyncOutboxRecord": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "environmentId": {
            "type": "string"
          },
          "laneOwner": {
            "type": "string"
          },
          "approvedUseCaseId": {
            "type": "string"
          },
          "sourceEventType": {
            "type": "string"
          },
          "sourceEventId": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time"
          },
          "event": {
            "$ref": "#/components/schemas/RegionalSyncAsyncHandoffEvent"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JsonNode": {
        "type": "object"
      },
      "RegionalSyncConsentCurationRecord": {
        "type": "object",
        "properties": {
          "consentCurationId": {
            "type": "string"
          },
          "tenantId": {
            "type": "string"
          },
          "approvedUseCaseId": {
            "type": "string"
          },
          "siteId": {
            "type": "string"
          },
          "programId": {
            "type": "string"
          },
          "regionId": {
            "type": "string"
          },
          "hieId": {
            "type": "string"
          },
          "consentScope": {
            "type": "string"
          },
          "consentCategory": {
            "type": "string"
          },
          "consentDataClass": {
            "type": "string"
          },
          "authorizedPartyClass": {
            "type": "string"
          },
          "reportingState": {
            "type": "string",
            "enum": [
              "ACTIVE_PERMIT",
              "ACTIVE_DENY",
              "REVOKED",
              "EXPIRED",
              "DELETED",
              "UNKNOWN"
            ]
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "tokenScopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "evidenceRefs": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CohortMembershipContext": {
        "type": "object",
        "properties": {
          "cohortId": {
            "type": "string",
            "format": "uuid"
          },
          "runId": {
            "type": "string",
            "format": "uuid"
          },
          "runStatus": {
            "type": "string"
          },
          "matched": {
            "type": "boolean"
          },
          "inclusionReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncPatientResponse": {
        "type": "object",
        "properties": {
          "patientId": {
            "type": "string",
            "format": "uuid"
          },
          "regionalProfile": {
            "$ref": "#/components/schemas/JsonNode"
          },
          "cohortMembership": {
            "$ref": "#/components/schemas/CohortMembershipContext"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncDeliveryExceptionResponse": {
        "type": "object",
        "properties": {
          "deliveryId": {
            "type": "string",
            "format": "uuid"
          },
          "tenantId": {
            "type": "string"
          },
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "clientId": {
            "type": "string"
          },
          "clientName": {
            "type": "string"
          },
          "cohortId": {
            "type": "string",
            "format": "uuid"
          },
          "runId": {
            "type": "string",
            "format": "uuid"
          },
          "patientId": {
            "type": "string",
            "format": "uuid"
          },
          "patientName": {
            "type": "string"
          },
          "privacyMode": {
            "type": "string",
            "enum": [
              "IDENTIFIED",
              "LIMITED",
              "DE_IDENTIFIED",
              "PSEUDONYMIZED"
            ]
          },
          "deliveryStatus": {
            "type": "string",
            "enum": [
              "PREPARED",
              "QUEUED",
              "PUBLISHED",
              "FAILED"
            ]
          },
          "gateStatus": {
            "type": "string",
            "enum": [
              "READY",
              "WARNING",
              "BLOCKED"
            ]
          },
          "sourceWatermark": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "gateIssues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionalSyncDeliveryIssueResponse"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncContractStatusResponse": {
        "type": "object",
        "properties": {
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "clientId": {
            "type": "string"
          },
          "clientName": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "lifecycleStatus": {
            "type": "string",
            "enum": [
              "NO_ACTIVITY",
              "PREPARED_PENDING_QUEUE",
              "QUEUED_FOR_COORDINATION",
              "COORDINATED",
              "ACTION_REQUIRED"
            ]
          },
          "totalDeliveries": {
            "type": "integer",
            "format": "int64"
          },
          "preparedCount": {
            "type": "integer",
            "format": "int64"
          },
          "queuedCount": {
            "type": "integer",
            "format": "int64"
          },
          "publishedCount": {
            "type": "integer",
            "format": "int64"
          },
          "failedCount": {
            "type": "integer",
            "format": "int64"
          },
          "blockedDeliveryCount": {
            "type": "integer",
            "format": "int64"
          },
          "warningDeliveryCount": {
            "type": "integer",
            "format": "int64"
          },
          "pendingAcknowledgementCount": {
            "type": "integer",
            "format": "int64"
          },
          "acknowledgedCount": {
            "type": "integer",
            "format": "int64"
          },
          "latestPreparedAt": {
            "type": "string",
            "format": "date-time"
          },
          "latestUpdatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "latestSourceWatermark": {
            "type": "string",
            "format": "date-time"
          },
          "oldestPendingPreparedAt": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncProjectionResponse": {
        "type": "object",
        "properties": {
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "clientId": {
            "type": "string"
          },
          "clientName": {
            "type": "string"
          },
          "patientId": {
            "type": "string",
            "format": "uuid"
          },
          "privacyMode": {
            "type": "string",
            "enum": [
              "IDENTIFIED",
              "LIMITED",
              "DE_IDENTIFIED",
              "PSEUDONYMIZED"
            ]
          },
          "projectionPolicyVersion": {
            "type": "string"
          },
          "projectedProfile": {
            "$ref": "#/components/schemas/JsonNode"
          },
          "includedFieldGroups": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "IDENTITY",
                "DEMOGRAPHICS",
                "COVERAGE",
                "COMPLETENESS",
                "PROVENANCE",
                "COHORT_MEMBERSHIP",
                "LOCATION"
              ]
            }
          },
          "suppressedPaths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "transformedPaths": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "projectionChecksum": {
            "type": "string"
          },
          "sourceWatermark": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncDeliveryAuditEventResponse": {
        "type": "object",
        "properties": {
          "eventId": {
            "type": "string",
            "format": "uuid"
          },
          "deliveryId": {
            "type": "string",
            "format": "uuid"
          },
          "actionType": {
            "type": "string",
            "enum": [
              "PREPARED",
              "REFRESHED",
              "QUEUED",
              "PUBLISH_KICKED_OFF",
              "PUBLISH_REFRESHED",
              "ACKNOWLEDGED",
              "RECEIPT_RECORDED",
              "REQUEUED",
              "REPLAY_REQUESTED"
            ]
          },
          "previousStatus": {
            "type": "string",
            "enum": [
              "PREPARED",
              "QUEUED",
              "PUBLISHED",
              "FAILED"
            ]
          },
          "currentStatus": {
            "type": "string",
            "enum": [
              "PREPARED",
              "QUEUED",
              "PUBLISHED",
              "FAILED"
            ]
          },
          "previousAcknowledgementStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "ACKNOWLEDGED"
            ]
          },
          "currentAcknowledgementStatus": {
            "type": "string",
            "enum": [
              "NOT_REQUIRED",
              "PENDING",
              "ACKNOWLEDGED"
            ]
          },
          "actorType": {
            "type": "string",
            "enum": [
              "SYSTEM",
              "OPERATOR",
              "DOWNSTREAM_SYSTEM"
            ]
          },
          "actorId": {
            "type": "string"
          },
          "actorDisplay": {
            "type": "string"
          },
          "evidenceReference": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncDeliveryEvidenceResponse": {
        "type": "object",
        "properties": {
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "deliveryId": {
            "type": "string",
            "format": "uuid"
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "replayRequestedCount": {
            "type": "integer",
            "format": "int64"
          },
          "delivery": {
            "$ref": "#/components/schemas/RegionalSyncDeliveryLedgerEntryResponse"
          },
          "auditTrail": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionalSyncDeliveryAuditEventResponse"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncDeliveryEvidenceExportResponse": {
        "type": "object",
        "properties": {
          "contractId": {
            "type": "string",
            "format": "uuid"
          },
          "clientId": {
            "type": "string"
          },
          "clientName": {
            "type": "string"
          },
          "cohortId": {
            "type": "string",
            "format": "uuid"
          },
          "runId": {
            "type": "string",
            "format": "uuid"
          },
          "patientId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "PREPARED",
              "QUEUED",
              "PUBLISHED",
              "FAILED"
            ]
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "exportedDeliveryCount": {
            "type": "integer",
            "format": "int32"
          },
          "replayRequestedCount": {
            "type": "integer",
            "format": "int64"
          },
          "contractStatus": {
            "$ref": "#/components/schemas/RegionalSyncContractStatusResponse"
          },
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionalSyncDeliveryEvidenceResponse"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncConsentWarehouseProjectionResponse": {
        "type": "object",
        "properties": {
          "tenantId": {
            "type": "string"
          },
          "approvedUseCaseId": {
            "type": "string"
          },
          "siteId": {
            "type": "string"
          },
          "programId": {
            "type": "string"
          },
          "regionId": {
            "type": "string"
          },
          "hieId": {
            "type": "string"
          },
          "consentCategory": {
            "type": "string"
          },
          "totalRecords": {
            "type": "integer",
            "format": "int32"
          },
          "countsByReportingState": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64"
            }
          },
          "suppressionState": {
            "type": "string"
          },
          "suppressionThreshold": {
            "type": "integer",
            "format": "int32"
          },
          "projectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionalSyncConsentCurationRecord"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncConsentWarehouseReadinessIssue": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "severity": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "affectedRecords": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "RegionalSyncConsentWarehouseReadinessResponse": {
        "type": "object",
        "properties": {
          "tenantId": {
            "type": "string"
          },
          "approvedUseCaseId": {
            "type": "string"
          },
          "siteId": {
            "type": "string"
          },
          "programId": {
            "type": "string"
          },
          "regionId": {
            "type": "string"
          },
          "hieId": {
            "type": "string"
          },
          "consentCategory": {
            "type": "string"
          },
          "totalRecords": {
            "type": "integer",
            "format": "int32"
          },
          "countsByReportingState": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64"
            }
          },
          "tokenCoverageByScope": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "format": "int64"
            }
          },
          "evidenceBackedRecords": {
            "type": "integer",
            "format": "int32"
          },
          "readinessScore": {
            "type": "number",
            "format": "double"
          },
          "readinessBand": {
            "type": "string"
          },
          "suppressionState": {
            "type": "string"
          },
          "suppressionThreshold": {
            "type": "integer",
            "format": "int32"
          },
          "projectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionalSyncConsentWarehouseReadinessIssue"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncCohortDefinitionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tenantId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "definitionVersion": {
            "type": "integer",
            "format": "int32"
          },
          "rootGroup": {
            "$ref": "#/components/schemas/JsonNode"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time"
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RegionalSyncCohortDetailResponse": {
        "type": "object",
        "properties": {
          "definition": {
            "$ref": "#/components/schemas/RegionalSyncCohortDefinitionResponse"
          },
          "latestRun": {
            "$ref": "#/components/schemas/RegionalSyncCohortRunResponse"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncCohortRunResponse": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string",
            "format": "uuid"
          },
          "definitionVersion": {
            "type": "integer",
            "format": "int32"
          },
          "status": {
            "type": "string"
          },
          "totalPatientsEvaluated": {
            "type": "integer",
            "format": "int32"
          },
          "matchedPatients": {
            "type": "integer",
            "format": "int32"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RegionalSyncMemberResponse": {
        "type": "object",
        "properties": {
          "patientId": {
            "type": "string",
            "format": "uuid"
          },
          "patientName": {
            "type": "string"
          },
          "gender": {
            "type": "string"
          },
          "age": {
            "type": "integer",
            "format": "int32"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "inclusionReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "profileSummary": {
            "$ref": "#/components/schemas/RegionalSyncPatientProfileSummary"
          }
        }
      },
      "RegionalSyncMembersResponse": {
        "type": "object",
        "properties": {
          "cohortId": {
            "type": "string",
            "format": "uuid"
          },
          "runId": {
            "type": "string",
            "format": "uuid"
          },
          "runStatus": {
            "type": "string"
          },
          "page": {
            "$ref": "#/components/schemas/RegionalSyncPageRegionalSyncMemberResponse"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RegionalSyncPageRegionalSyncMemberResponse": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionalSyncMemberResponse"
            }
          },
          "number": {
            "type": "integer",
            "format": "int32"
          },
          "size": {
            "type": "integer",
            "format": "int32"
          },
          "totalElements": {
            "type": "integer",
            "format": "int64"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "RegionalSyncPatientProfileSummary": {
        "type": "object",
        "properties": {
          "completenessScorePercent": {
            "type": "integer",
            "format": "int32"
          },
          "missingRequiredDataClasses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "locationDisplay": {
            "type": "string"
          },
          "locationState": {
            "type": "string"
          },
          "provenanceState": {
            "type": "string"
          },
          "freshestSourceUpdatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RegionalSyncCapabilitiesResponse": {
        "type": "object",
        "properties": {
          "serviceName": {
            "type": "string"
          },
          "serviceVersion": {
            "type": "string"
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dependencySurfaces": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearer-jwt": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}