{
  "openapi": "3.1.0",
  "info": {
    "title": "ailix Bridge 내부 제어 API",
    "version": "0.1.0",
    "description": "전송허가와 작업 상태를 관리하는 ailix 내부 제어 API입니다. 합성 자료의 로컬 송수신·조회 시험만 허용하며 운영 병원 송신과 원본/연구 허가 경로는 비활성입니다.",
    "contact": {
      "name": "MENINBLOX Ailix",
      "url": "https://ailix.meninblox.com"
    }
  },
  "servers": [
    {
      "url": "https://example.invalid/api/bridge/v1",
      "description": "호출할 수 없는 문서용 주소입니다. 실제 주소는 별도 제공합니다."
    }
  ],
  "security": [
    {
      "userToken": []
    }
  ],
  "tags": [
    {
      "name": "connectors",
      "description": "수신기관별 연결 설정과 버전을 관리합니다."
    },
    {
      "name": "deliveries",
      "description": "전송허가에 연결된 작업 상태와 메타데이터입니다."
    }
  ],
  "paths": {
    "/connectors": {
      "get": {
        "tags": [
          "connectors"
        ],
        "summary": "연결 설정 목록 조회",
        "operationId": "listBridgeConnectors",
        "responses": {
          "200": {
            "description": "작업 메타데이터만 반환합니다. 임상 본문과 영수증 원문은 포함하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Connector"
                      }
                    }
                  },
                  "required": [
                    "items"
                  ]
                },
                "example": {
                  "items": [
                    {
                      "id": "hospital-a",
                      "version": "1",
                      "destination_org_id": "hospital-a",
                      "adapter": "synthetic",
                      "channels": [
                        "fhir"
                      ],
                      "verification_level": "synthetic",
                      "enabled": false,
                      "max_concurrency": 1,
                      "live_supported": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          }
        },
        "security": [
          {
            "userToken": [
              "admin"
            ]
          }
        ],
        "parameters": [],
        "description": "로컬 합성 자료용 연결 설정입니다. 운영 병원 어댑터는 제공하지 않습니다."
      },
      "post": {
        "tags": [
          "connectors"
        ],
        "summary": "연결 설정 등록",
        "operationId": "createBridgeConnector",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectorCreate"
              },
              "example": {
                "id": "hospital-a",
                "version": "1",
                "destination_org_id": "hospital-a",
                "adapter": "synthetic",
                "channels": [
                  "fhir"
                ],
                "verification_level": "synthetic",
                "enabled": false,
                "max_concurrency": 1
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "작업 메타데이터만 반환합니다. 임상 본문과 영수증 원문은 포함하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Connector"
                },
                "example": {
                  "id": "hospital-a",
                  "version": "1",
                  "destination_org_id": "hospital-a",
                  "adapter": "synthetic",
                  "channels": [
                    "fhir"
                  ],
                  "verification_level": "synthetic",
                  "enabled": false,
                  "max_concurrency": 1,
                  "live_supported": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          }
        },
        "security": [
          {
            "userToken": [
              "admin"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CommonIdempotencyKeyOptional"
          }
        ],
        "description": "로컬 합성 자료용 연결 설정입니다. 운영 병원 어댑터는 제공하지 않습니다."
      }
    },
    "/connectors/{connector_id}/{version}/stop": {
      "post": {
        "tags": [
          "connectors"
        ],
        "summary": "연결 설정 중지",
        "operationId": "stopBridgeConnector",
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Connector Id"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Version"
            }
          },
          {
            "$ref": "#/components/parameters/CommonIdempotencyKeyOptional"
          }
        ],
        "responses": {
          "200": {
            "description": "작업 메타데이터만 반환합니다. 임상 본문과 영수증 원문은 포함하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Connector"
                },
                "example": {
                  "id": "hospital-a",
                  "version": "1",
                  "destination_org_id": "hospital-a",
                  "adapter": "synthetic",
                  "channels": [
                    "fhir"
                  ],
                  "verification_level": "synthetic",
                  "enabled": false,
                  "max_concurrency": 1,
                  "live_supported": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          }
        },
        "security": [
          {
            "userToken": [
              "admin"
            ]
          }
        ],
        "description": "로컬 합성 자료용 연결 설정입니다. 운영 병원 어댑터는 제공하지 않습니다."
      }
    },
    "/connectors/{connector_id}/{version}/enable": {
      "post": {
        "tags": [
          "connectors"
        ],
        "summary": "시험 연결 설정 활성화",
        "operationId": "enableBridgeConnector",
        "parameters": [
          {
            "name": "connector_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Connector Id"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Version"
            }
          },
          {
            "$ref": "#/components/parameters/CommonIdempotencyKeyOptional"
          }
        ],
        "responses": {
          "200": {
            "description": "작업 메타데이터만 반환합니다. 임상 본문과 영수증 원문은 포함하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Connector"
                },
                "example": {
                  "id": "hospital-a",
                  "version": "1",
                  "destination_org_id": "hospital-a",
                  "adapter": "synthetic",
                  "channels": [
                    "fhir"
                  ],
                  "verification_level": "synthetic",
                  "enabled": false,
                  "max_concurrency": 1,
                  "live_supported": false
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          }
        },
        "security": [
          {
            "userToken": [
              "admin"
            ]
          }
        ],
        "description": "로컬 합성 자료용 연결 설정입니다. 운영 병원 어댑터는 제공하지 않습니다."
      }
    },
    "/deliveries": {
      "post": {
        "tags": [
          "deliveries"
        ],
        "summary": "전송 작업 생성",
        "operationId": "createBridgeDelivery",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "작업 생성에 필수입니다. 실행자·조직·본문에 연결해 작업과 함께 보관합니다. 완료 참조 정리 후에도 업무 중복 방지 해시를 유지하며 24시간 뒤 재사용을 보장하지 않습니다.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliveryCreate"
              },
              "example": {
                "grant_id": "synthetic-grant",
                "connector_id": "hospital-a",
                "connector_version": "1",
                "channels": [
                  "fhir"
                ],
                "dry_run": true
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "작업 메타데이터만 반환합니다. 임상 본문과 영수증 원문은 포함하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              },
              "Location": {
                "description": "전송 작업 상태를 조회하는 경로입니다.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryManifest"
                },
                "example": {
                  "id": "00000000-0000-4000-8000-000000000001",
                  "state": "queued",
                  "dry_run": true,
                  "issue_code": null,
                  "source_revision": "synthetic-source-revision",
                  "destination_org_id": "hospital-a",
                  "connector_id": "hospital-a",
                  "connector_version": "1",
                  "versions": {
                    "schema": "1.0",
                    "transform": "0.1.0",
                    "fhir": "4.0.1",
                    "omop": "5.4",
                    "terminology": "unconfigured",
                    "codec": "unconfigured"
                  },
                  "created_at": "2026-11-05T00:00:00Z",
                  "updated_at": "2026-11-05T00:00:00Z",
                  "channels": [
                    {
                      "channel": "fhir",
                      "state": "queued",
                      "items": []
                    }
                  ]
                }
              }
            }
          },
          "200": {
            "description": "같은 실행자·요청 키·본문의 재호출입니다. 기존 작업 메타데이터만 반환하고 전송 권한을 갱신하거나 연장하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryManifest"
                },
                "example": {
                  "id": "00000000-0000-4000-8000-000000000001",
                  "state": "queued",
                  "dry_run": true,
                  "issue_code": null,
                  "source_revision": "synthetic-source-revision",
                  "destination_org_id": "hospital-a",
                  "connector_id": "hospital-a",
                  "connector_version": "1",
                  "versions": {
                    "schema": "1.0",
                    "transform": "0.1.0",
                    "fhir": "4.0.1",
                    "omop": "5.4",
                    "terminology": "unconfigured",
                    "codec": "unconfigured"
                  },
                  "created_at": "2026-11-05T00:00:00Z",
                  "updated_at": "2026-11-05T00:00:00Z",
                  "channels": [
                    {
                      "channel": "fhir",
                      "state": "queued",
                      "items": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "413": {
            "description": "승인 묶음이 크기 상한을 초과했습니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "payload-too-large": {
                    "$ref": "#/components/examples/Commonpayload-too-large"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          },
          "422": {
            "$ref": "#/components/responses/CommonIdempotencyConflict"
          }
        },
        "security": [
          {
            "userToken": [
              "staff/abroad"
            ]
          },
          {
            "userToken": [
              "doctor/abroad"
            ]
          }
        ],
        "description": "실행자 범위의 작업을 생성하거나 기존 결과를 반환합니다. 같은 키의 재호출은 권한을 갱신하지 않습니다. 다른 본문은 422 idempotency-conflict, 다른 키의 중복 업무는 409입니다. 송수신 시험은 등록된 local/test 설정에서만 허용하며 운영 병원 송신은 비활성입니다.",
        "x-idempotent": true
      }
    },
    "/deliveries/{delivery_id}": {
      "get": {
        "tags": [
          "deliveries"
        ],
        "summary": "전송 작업 조회",
        "operationId": "getBridgeDelivery",
        "parameters": [
          {
            "name": "delivery_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Delivery Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "작업 메타데이터만 반환합니다. 임상 본문과 영수증 원문은 포함하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryManifest"
                },
                "example": {
                  "id": "00000000-0000-4000-8000-000000000001",
                  "state": "queued",
                  "dry_run": true,
                  "issue_code": null,
                  "source_revision": "synthetic-source-revision",
                  "destination_org_id": "hospital-a",
                  "connector_id": "hospital-a",
                  "connector_version": "1",
                  "versions": {
                    "schema": "1.0",
                    "transform": "0.1.0",
                    "fhir": "4.0.1",
                    "omop": "5.4",
                    "terminology": "unconfigured",
                    "codec": "unconfigured"
                  },
                  "created_at": "2026-11-05T00:00:00Z",
                  "updated_at": "2026-11-05T00:00:00Z",
                  "channels": [
                    {
                      "channel": "fhir",
                      "state": "queued",
                      "items": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          }
        },
        "security": [
          {
            "userToken": [
              "staff/abroad"
            ]
          },
          {
            "userToken": [
              "doctor/abroad"
            ]
          }
        ],
        "description": "전송허가에 연결된 작업 API입니다. 운영 병원 송신은 비활성입니다."
      }
    },
    "/deliveries/{delivery_id}/cancel": {
      "post": {
        "tags": [
          "deliveries"
        ],
        "summary": "미전송 작업 취소",
        "operationId": "cancelBridgeDelivery",
        "parameters": [
          {
            "name": "delivery_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Delivery Id"
            }
          },
          {
            "$ref": "#/components/parameters/CommonIdempotencyKeyOptional"
          }
        ],
        "responses": {
          "200": {
            "description": "작업 메타데이터만 반환합니다. 임상 본문과 영수증 원문은 포함하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryManifest"
                },
                "example": {
                  "id": "00000000-0000-4000-8000-000000000001",
                  "state": "queued",
                  "dry_run": true,
                  "issue_code": null,
                  "source_revision": "synthetic-source-revision",
                  "destination_org_id": "hospital-a",
                  "connector_id": "hospital-a",
                  "connector_version": "1",
                  "versions": {
                    "schema": "1.0",
                    "transform": "0.1.0",
                    "fhir": "4.0.1",
                    "omop": "5.4",
                    "terminology": "unconfigured",
                    "codec": "unconfigured"
                  },
                  "created_at": "2026-11-05T00:00:00Z",
                  "updated_at": "2026-11-05T00:00:00Z",
                  "channels": [
                    {
                      "channel": "fhir",
                      "state": "queued",
                      "items": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          }
        },
        "security": [
          {
            "userToken": [
              "staff/abroad"
            ]
          },
          {
            "userToken": [
              "doctor/abroad"
            ]
          }
        ],
        "description": "전송허가에 연결된 작업 API입니다. 운영 병원 송신은 비활성입니다."
      }
    },
    "/deliveries/{delivery_id}/retry": {
      "post": {
        "tags": [
          "deliveries"
        ],
        "summary": "실패 항목 재시도",
        "operationId": "retryBridgeDelivery",
        "parameters": [
          {
            "name": "delivery_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Delivery Id"
            }
          },
          {
            "$ref": "#/components/parameters/CommonIdempotencyKeyOptional"
          }
        ],
        "responses": {
          "202": {
            "description": "작업 메타데이터만 반환합니다. 임상 본문과 영수증 원문은 포함하지 않습니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryManifest"
                },
                "example": {
                  "id": "00000000-0000-4000-8000-000000000001",
                  "state": "queued",
                  "dry_run": true,
                  "issue_code": null,
                  "source_revision": "synthetic-source-revision",
                  "destination_org_id": "hospital-a",
                  "connector_id": "hospital-a",
                  "connector_version": "1",
                  "versions": {
                    "schema": "1.0",
                    "transform": "0.1.0",
                    "fhir": "4.0.1",
                    "omop": "5.4",
                    "terminology": "unconfigured",
                    "codec": "unconfigured"
                  },
                  "created_at": "2026-11-05T00:00:00Z",
                  "updated_at": "2026-11-05T00:00:00Z",
                  "channels": [
                    {
                      "channel": "fhir",
                      "state": "queued",
                      "items": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "413": {
            "description": "승인 묶음이 크기 상한을 초과했습니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "payload-too-large": {
                    "$ref": "#/components/examples/Commonpayload-too-large"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          }
        },
        "security": [
          {
            "userToken": [
              "staff/abroad"
            ]
          },
          {
            "userToken": [
              "doctor/abroad"
            ]
          }
        ],
        "description": "전송허가에 연결된 작업 API입니다. 운영 병원 송신은 비활성입니다.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeliveryRetry"
              },
              "example": {}
            }
          }
        }
      }
    },
    "/deliveries/{delivery_id}/reconcile": {
      "post": {
        "tags": [
          "deliveries"
        ],
        "summary": "수신 불명 결과 재조회",
        "operationId": "reconcileBridgeDelivery",
        "parameters": [
          {
            "name": "delivery_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Delivery Id"
            }
          },
          {
            "$ref": "#/components/parameters/CommonIdempotencyKeyOptional"
          }
        ],
        "responses": {
          "200": {
            "description": "로컬 시험 수신 조회를 마쳤습니다. 내용을 확인하지 못하면 수신 불명 상태를 유지합니다.",
            "headers": {
              "Cache-Control": {
                "$ref": "#/components/headers/CommonCacheControlNoStore"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryManifest"
                },
                "example": {
                  "id": "00000000-0000-4000-8000-000000000001",
                  "state": "confirmed",
                  "dry_run": false,
                  "issue_code": null,
                  "source_revision": "synthetic-source-revision",
                  "destination_org_id": "lab-a",
                  "connector_id": "lab-a",
                  "connector_version": "1",
                  "versions": {
                    "schema": "1.0",
                    "transform": "0.1.0",
                    "fhir": "4.0.1",
                    "omop": "5.4",
                    "terminology": "unconfigured",
                    "codec": "unconfigured"
                  },
                  "created_at": "2026-11-05T00:00:00Z",
                  "updated_at": "2026-11-05T00:01:00Z",
                  "channels": [
                    {
                      "channel": "fhir",
                      "state": "confirmed",
                      "items": [
                        {
                          "id": "00000000-0000-4000-8000-000000000002",
                          "state": "confirmed",
                          "artifact_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                          "artifact_version": "1",
                          "attempts": 1,
                          "receipt_code": "receiver-confirmed"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CommonValidationError"
          },
          "401": {
            "$ref": "#/components/responses/CommonUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/CommonForbidden"
          },
          "404": {
            "$ref": "#/components/responses/CommonNotFound"
          },
          "409": {
            "description": "작업 상태·허가 연결·중복 업무가 충돌하거나 실송신이 비활성입니다.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/CommonProblem"
                },
                "examples": {
                  "invalid-state-transition": {
                    "$ref": "#/components/examples/Commoninvalid-state-transition"
                  }
                }
              }
            }
          },
          "503": {
            "$ref": "#/components/responses/CommonDependencyUnavailable"
          }
        },
        "security": [
          {
            "userToken": [
              "staff/abroad"
            ]
          },
          {
            "userToken": [
              "doctor/abroad"
            ]
          }
        ],
        "description": "등록된 local/test 시험 어댑터가 uncertain·awaiting_confirmation 작업을 조회·대조합니다. 확인되지 않은 항목은 uncertain으로 남깁니다. 허가·연결 설정을 재확인하고 자료를 재전송하지 않습니다. 운영 병원 조회는 비활성입니다."
      }
    }
  },
  "components": {
    "securitySchemes": {
      "userToken": {
        "$ref": "#/components/securitySchemes/CommonuserToken"
      },
      "CommonuserToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Cognito 사용자 access token을 검증합니다. iss·client_id를 허용목록으로 제한하고 조직·역할을 검사합니다. 병원 기관용 서비스 계정의 인증 계약은 별도입니다."
      }
    },
    "schemas": {
      "ConnectorCreate": {
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "title": "Id"
          },
          "version": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,32}$",
            "title": "Version"
          },
          "destination_org_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "title": "Destination Org Id"
          },
          "adapter": {
            "type": "string",
            "enum": [
              "synthetic",
              "sandbox"
            ],
            "title": "Adapter",
            "default": "synthetic"
          },
          "channels": {
            "items": {
              "type": "string",
              "enum": [
                "fhir",
                "dicom",
                "omop"
              ]
            },
            "type": "array",
            "maxItems": 3,
            "minItems": 1,
            "title": "Channels",
            "uniqueItems": true
          },
          "verification_level": {
            "type": "string",
            "enum": [
              "synthetic",
              "protocol_tested",
              "institution_verified"
            ],
            "title": "Verification Level",
            "default": "synthetic"
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled",
            "default": false
          },
          "max_concurrency": {
            "type": "integer",
            "maximum": 20.0,
            "minimum": 1.0,
            "title": "Max Concurrency",
            "default": 1
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id",
          "version",
          "destination_org_id",
          "channels"
        ],
        "title": "ConnectorCreate"
      },
      "DeliveryCreate": {
        "properties": {
          "grant_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "title": "Grant Id"
          },
          "connector_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "title": "Connector Id"
          },
          "connector_version": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,32}$",
            "title": "Connector Version"
          },
          "channels": {
            "items": {
              "type": "string",
              "enum": [
                "fhir",
                "dicom",
                "omop"
              ]
            },
            "type": "array",
            "maxItems": 3,
            "minItems": 1,
            "title": "Channels",
            "uniqueItems": true
          },
          "dry_run": {
            "type": "boolean",
            "title": "Dry Run",
            "default": true
          },
          "mapping_ref": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "title": "Mapping Ref",
            "default": "unmapped"
          },
          "mapping_version": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,32}$",
            "title": "Mapping Version",
            "default": "unmapped"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "grant_id",
          "connector_id",
          "connector_version",
          "channels"
        ],
        "title": "DeliveryCreate"
      },
      "Problem": {
        "$ref": "#/components/schemas/CommonProblem"
      },
      "DeliveryItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "preparing",
              "validated",
              "sending",
              "awaiting_confirmation",
              "confirmed",
              "partial",
              "blocked",
              "failed",
              "uncertain",
              "cancelled"
            ]
          },
          "artifact_hash": {
            "type": "string"
          },
          "artifact_version": {
            "type": "string"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "receipt_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "state",
          "artifact_hash",
          "artifact_version",
          "attempts",
          "receipt_code"
        ]
      },
      "DeliveryChannel": {
        "type": "object",
        "properties": {
          "channel": {
            "type": "string",
            "enum": [
              "fhir",
              "dicom",
              "omop"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "preparing",
              "validated",
              "sending",
              "awaiting_confirmation",
              "confirmed",
              "partial",
              "blocked",
              "failed",
              "uncertain",
              "cancelled"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryItem"
            }
          }
        },
        "required": [
          "channel",
          "state",
          "items"
        ]
      },
      "DeliveryManifest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "queued",
              "preparing",
              "validated",
              "sending",
              "awaiting_confirmation",
              "confirmed",
              "partial",
              "blocked",
              "failed",
              "uncertain",
              "cancelled"
            ]
          },
          "dry_run": {
            "type": "boolean"
          },
          "issue_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source_revision": {
            "type": "string"
          },
          "destination_org_id": {
            "type": "string"
          },
          "connector_id": {
            "type": "string"
          },
          "connector_version": {
            "type": "string"
          },
          "versions": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "channels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryChannel"
            },
            "uniqueItems": true
          }
        },
        "required": [
          "id",
          "state",
          "dry_run",
          "issue_code",
          "source_revision",
          "destination_org_id",
          "connector_id",
          "connector_version",
          "versions",
          "created_at",
          "updated_at",
          "channels"
        ]
      },
      "Connector": {
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "title": "Id"
          },
          "version": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,32}$",
            "title": "Version"
          },
          "destination_org_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$",
            "title": "Destination Org Id"
          },
          "adapter": {
            "type": "string",
            "enum": [
              "synthetic",
              "sandbox"
            ],
            "title": "Adapter",
            "default": "synthetic"
          },
          "channels": {
            "items": {
              "type": "string",
              "enum": [
                "fhir",
                "dicom",
                "omop"
              ]
            },
            "type": "array",
            "maxItems": 3,
            "minItems": 1,
            "title": "Channels",
            "uniqueItems": true
          },
          "verification_level": {
            "type": "string",
            "enum": [
              "synthetic",
              "protocol_tested",
              "institution_verified"
            ],
            "title": "Verification Level",
            "default": "synthetic"
          },
          "enabled": {
            "type": "boolean",
            "title": "Enabled",
            "default": false
          },
          "max_concurrency": {
            "type": "integer",
            "maximum": 20.0,
            "minimum": 1.0,
            "title": "Max Concurrency",
            "default": 1
          },
          "live_supported": {
            "type": "boolean",
            "const": false
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id",
          "version",
          "destination_org_id",
          "adapter",
          "channels",
          "verification_level",
          "enabled",
          "max_concurrency",
          "live_supported"
        ],
        "title": "Connector"
      },
      "DeliveryRetry": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "grant_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,64}$"
          },
          "connector_version": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.-]{1,32}$"
          }
        },
        "description": "같은 원천 버전·수신기관에 대해 허가나 연결 버전을 갱신할 수 있습니다. 수신 불명·기전송 항목의 무단 재전송은 차단합니다."
      },
      "CommonProblem": {
        "type": "object",
        "description": "RFC 9457 application/problem+json 오류입니다. 확장 필드를 허용하며 개발자용 detail에도 개인정보를 넣지 않습니다.",
        "required": [
          "type",
          "title",
          "status",
          "code",
          "request_id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://ailix\\.meninblox\\.com/problems/[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "오류 유형 URI: https://ailix.meninblox.com/problems/{code}"
          },
          "title": {
            "type": "string",
            "description": "오류 유형을 나타내는 고정 영문 제목입니다."
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string",
            "description": "요청 경로입니다."
          },
          "code": {
            "type": "string",
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "오류 코드입니다. 알 수 없는 코드는 일반 오류로 처리합니다."
          },
          "request_id": {
            "$ref": "#/components/schemas/CommonRequestIdValue"
          },
          "errors": {
            "type": "array",
            "description": "필드별 입력 오류입니다. HTTP 400 validation-error로 반환합니다.",
            "items": {
              "$ref": "#/components/schemas/CommonProblemFieldError"
            }
          }
        },
        "additionalProperties": true
      },
      "CommonRequestIdValue": {
        "type": "string",
        "minLength": 1,
        "maxLength": 128
      },
      "CommonProblemFieldError": {
        "type": "object",
        "required": [
          "field",
          "reason"
        ],
        "properties": {
          "field": {
            "type": "string",
            "description": "잘못된 값의 위치입니다. 예: body.items.0.text 또는 query.limit."
          },
          "reason": {
            "type": "string",
            "description": "프로그램이 처리하는 snake_case 사유입니다. 예: missing, string_too_long."
          }
        }
      },
      "CommonIdempotencyKeyValue": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255
      }
    },
    "headers": {
      "CommonCacheControlNoStore": {
        "description": "환자 자료가 포함된 응답은 캐시하지 않습니다.",
        "schema": {
          "type": "string",
          "const": "no-store"
        },
        "example": "no-store"
      },
      "CommonRetryAfter": {
        "description": "재시도 전 기다릴 초입니다. 429·503·멱등 요청 처리 중 응답에 적용됩니다.",
        "schema": {
          "type": "integer",
          "minimum": 0
        },
        "example": 5
      }
    },
    "responses": {
      "CommonValidationError": {
        "description": "형식이 잘못되었거나 필수 값이 없습니다.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/CommonProblem"
            },
            "examples": {
              "validation-error": {
                "$ref": "#/components/examples/Commonvalidation-error"
              }
            }
          }
        }
      },
      "CommonUnauthorized": {
        "description": "인증 토큰이 없거나 만료 또는 유효하지 않습니다.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/CommonProblem"
            },
            "examples": {
              "unauthorized": {
                "$ref": "#/components/examples/Commonunauthorized"
              }
            }
          }
        }
      },
      "CommonForbidden": {
        "description": "허용되지 않은 역할·범위이거나 서비스 전용 경로에 대한 외부 호출입니다.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/CommonProblem"
            },
            "examples": {
              "forbidden": {
                "$ref": "#/components/examples/Commonforbidden"
              }
            }
          }
        }
      },
      "CommonNotFound": {
        "description": "대상이 없거나 호출자 권한 밖입니다. 대상의 존재 여부를 노출하지 않습니다.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/CommonProblem"
            },
            "examples": {
              "not-found": {
                "$ref": "#/components/examples/Commonnot-found"
              }
            }
          }
        }
      },
      "CommonDependencyUnavailable": {
        "description": "의존 서비스가 실패했거나 제한시간을 초과했습니다.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/CommonRetryAfter"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/CommonProblem"
            },
            "examples": {
              "dependency-unavailable": {
                "$ref": "#/components/examples/Commondependency-unavailable"
              }
            }
          }
        }
      },
      "CommonIdempotencyConflict": {
        "description": "같은 Idempotency-Key를 다른 본문에 사용했습니다.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/CommonProblem"
            },
            "examples": {
              "idempotency-conflict": {
                "$ref": "#/components/examples/Commonidempotency-conflict"
              }
            }
          }
        }
      }
    },
    "examples": {
      "Commonvalidation-error": {
        "summary": "오류 응답 400 validation-error",
        "value": {
          "type": "https://ailix.meninblox.com/problems/validation-error",
          "title": "Validation error",
          "status": 400,
          "detail": "Request body failed validation.",
          "instance": "/v1/example-resources",
          "code": "validation-error",
          "request_id": "01928c3e-5a4b-7c1d-8e2f-3a4b5c6d7e8f",
          "errors": [
            {
              "field": "body.note",
              "reason": "string_too_long"
            }
          ]
        }
      },
      "Commonunauthorized": {
        "summary": "오류 응답 401 unauthorized",
        "value": {
          "type": "https://ailix.meninblox.com/problems/unauthorized",
          "title": "Unauthorized",
          "status": 401,
          "detail": "Token is missing, expired or has an invalid signature.",
          "instance": "/v1/example-resources",
          "code": "unauthorized",
          "request_id": "01928c3e-5a4b-7c1d-8e2f-3a4b5c6d7e8f"
        }
      },
      "Commonforbidden": {
        "summary": "오류 응답 403 forbidden",
        "value": {
          "type": "https://ailix.meninblox.com/problems/forbidden",
          "title": "Forbidden",
          "status": 403,
          "detail": "The caller's role or scope is not allowed on this path.",
          "instance": "/v1/example-resources",
          "code": "forbidden",
          "request_id": "01928c3e-5a4b-7c1d-8e2f-3a4b5c6d7e8f"
        }
      },
      "Commonnot-found": {
        "summary": "오류 응답 404 not-found",
        "value": {
          "type": "https://ailix.meninblox.com/problems/not-found",
          "title": "Not found",
          "status": 404,
          "detail": "Resource not found.",
          "instance": "/v1/example-resources",
          "code": "not-found",
          "request_id": "01928c3e-5a4b-7c1d-8e2f-3a4b5c6d7e8f"
        }
      },
      "Commoninvalid-state-transition": {
        "summary": "오류 응답 409 invalid-state-transition",
        "value": {
          "type": "https://ailix.meninblox.com/problems/invalid-state-transition",
          "title": "Invalid state transition",
          "status": 409,
          "detail": "The action is not allowed in the current state.",
          "instance": "/v1/example-resources",
          "code": "invalid-state-transition",
          "request_id": "01928c3e-5a4b-7c1d-8e2f-3a4b5c6d7e8f"
        }
      },
      "Commondependency-unavailable": {
        "summary": "오류 응답 503 dependency-unavailable",
        "value": {
          "type": "https://ailix.meninblox.com/problems/dependency-unavailable",
          "title": "Dependency unavailable",
          "status": 503,
          "detail": "Another service failed or timed out.",
          "instance": "/v1/example-resources",
          "code": "dependency-unavailable",
          "request_id": "01928c3e-5a4b-7c1d-8e2f-3a4b5c6d7e8f"
        }
      },
      "Commonpayload-too-large": {
        "summary": "오류 응답 413 payload-too-large",
        "value": {
          "type": "https://ailix.meninblox.com/problems/payload-too-large",
          "title": "Payload too large",
          "status": 413,
          "detail": "The text exceeds the mask size limit.",
          "instance": "/v1/example-resources",
          "code": "payload-too-large",
          "request_id": "01928c3e-5a4b-7c1d-8e2f-3a4b5c6d7e8f"
        }
      },
      "Commonidempotency-conflict": {
        "summary": "오류 응답 422 idempotency-conflict",
        "value": {
          "type": "https://ailix.meninblox.com/problems/idempotency-conflict",
          "title": "Idempotency key conflict",
          "status": 422,
          "detail": "The Idempotency-Key was already used with a different request body.",
          "instance": "/v1/example-resources",
          "code": "idempotency-conflict",
          "request_id": "01928c3e-5a4b-7c1d-8e2f-3a4b5c6d7e8f"
        }
      }
    },
    "parameters": {
      "CommonIdempotencyKeyOptional": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "선택적인 요청 키입니다. UI는 사용자 행동마다 새로운 UUID를 보냅니다.",
        "schema": {
          "$ref": "#/components/schemas/CommonIdempotencyKeyValue"
        },
        "example": "0f8e2a4c-1b3d-4e5f-8a7b-9c0d1e2f3a4b"
      }
    }
  },
  "x-ailix-scope": "internal-control-api",
  "x-ailix-hospital-inbound-api": "not-implemented"
}
