{
  "openapi": "3.1.0",
  "info": {
    "title": "MedDossier API",
    "summary": "MedDossier cross-border medical record packet API",
    "description": "Medical record intake, packet preparation, review, and sharing APIs for MedDossier partners.",
    "contact": {
      "name": "MedDossier Support",
      "email": "support@meddossier.com"
    },
    "license": {
      "name": "Internal Use Only"
    },
    "version": "0.1.0"
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "ops"
        ],
        "summary": "Health check",
        "operationId": "healthcheck_health_get",
        "responses": {
          "200": {
            "description": "Service health status",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object",
                  "title": "Response Healthcheck Health Get"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/user/data-deletion": {
      "post": {
        "summary": "Request Data Deletion",
        "operationId": "request_data_deletion_api_v1_user_data_deletion_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response Request Data Deletion Api V1 User Data Deletion Post"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v1/auth/login": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Sign in with workspace credentials",
        "description": "Use email/password login for patient, reviewer, or admin workspace access. Admin roles must also provide a valid OTP code.",
        "operationId": "login_api_v1_auth_login_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "JWT access and refresh tokens plus the resolved role context.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/demo": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Create a demo workspace session",
        "description": "Returns a demo login for the requested role when demo mode is enabled. Useful for local smoke tests and guided product walkthroughs.",
        "operationId": "demo_login_api_v1_auth_demo_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DemoLoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "JWT access and refresh tokens for the selected demo role.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/refresh": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Refresh an existing session",
        "description": "Exchanges a valid refresh token for a new access token pair without forcing the user to sign in again.",
        "operationId": "refresh_token_api_v1_auth_refresh_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "A new token pair with the same role context.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/me": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Current User",
        "operationId": "current_user_api_v1_auth_me_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v1/auth/password-reset/request": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Request a password reset link",
        "description": "Queues a password reset email when the account exists and is active, while keeping the response generic.",
        "operationId": "request_password_reset_api_v1_auth_password_reset_request_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordResetRequestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/password-reset/validate": {
      "get": {
        "tags": [
          "auth"
        ],
        "summary": "Validate a password reset link",
        "description": "Checks whether a password reset token is still active before the user submits a new password.",
        "operationId": "validate_password_reset_api_v1_auth_password_reset_validate_get",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 20,
              "maxLength": 255,
              "title": "Token"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordResetTokenValidationResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/auth/password-reset/confirm": {
      "post": {
        "tags": [
          "auth"
        ],
        "summary": "Set a new password from a reset link",
        "description": "Consumes the reset token, updates the password, and revokes existing refresh sessions.",
        "operationId": "confirm_password_reset_link_api_v1_auth_password_reset_confirm_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetConfirmRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PasswordResetConfirmResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/webhooks/stripe": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Receive Stripe checkout webhooks",
        "description": "Processes payment completion events and moves a paid order into the extraction pipeline.",
        "operationId": "stripe_webhook_api_v1_orders_webhooks_stripe_post",
        "parameters": [
          {
            "name": "stripe-signature",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Stripe-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook acknowledgement status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Stripe Webhook Api V1 Orders Webhooks Stripe Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Create a patient intake order",
        "description": "Starts a new case intake with patient details, authorization scope, package selection, and target hospital context.",
        "operationId": "create_order_endpoint_api_v1_orders_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created order with pricing, status, and related workflow metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderCreateResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "orders"
        ],
        "summary": "List a user's order history",
        "description": "Returns order history for the authenticated user. Ops and super admins can also inspect another user's history by email.",
        "operationId": "list_history_endpoint_api_v1_orders_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order history items visible to the authenticated requester.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HistoryResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}/files": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Upload source files for an order",
        "description": "Adds one or more PDFs or images to an existing intake order so OCR and extraction can begin after payment.",
        "operationId": "upload_order_files_api_v1_orders__order_id__files_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "x-order-access-token",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Order-Access-Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_upload_order_files_api_v1_orders__order_id__files_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated order including attached source files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientOrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}/pay": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Start payment for an intake order",
        "description": "Creates a Stripe Checkout session when live credentials exist, or records a demo payment in local demo mode.",
        "operationId": "pay_order_api_v1_orders__order_id__pay_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "x-order-access-token",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Order-Access-Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderPayRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment status plus checkout URL when Stripe Checkout is used.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}": {
      "get": {
        "tags": [
          "orders"
        ],
        "summary": "Fetch a single order",
        "description": "Returns the current case state, uploaded files, generated documents, and patient-facing delivery details.",
        "operationId": "get_order_endpoint_api_v1_orders__order_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "x-order-access-token",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Order-Access-Token"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientOrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}/documents": {
      "get": {
        "tags": [
          "orders"
        ],
        "summary": "List Documents",
        "operationId": "list_documents_api_v1_orders__order_id__documents_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "x-order-access-token",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Order-Access-Token"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PortalDocumentResponse"
                  },
                  "title": "Response List Documents Api V1 Orders  Order Id  Documents Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}/preview/{document_id}": {
      "get": {
        "tags": [
          "orders"
        ],
        "summary": "Preview a patient packet document",
        "description": "Streams a packet document inline for patient portal preview without incrementing the download counter.",
        "operationId": "preview_document_api_v1_orders__order_id__preview__document_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Document Id"
            }
          },
          {
            "name": "access",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Access"
            }
          },
          {
            "name": "x-order-access-token",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Order-Access-Token"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}/download/{document_id}": {
      "get": {
        "tags": [
          "orders"
        ],
        "summary": "Download Document",
        "operationId": "download_document_api_v1_orders__order_id__download__document_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Document Id"
            }
          },
          {
            "name": "access",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Access"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}/share": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Create a secure share link for a completed packet",
        "description": "Generates a time-limited share token for the primary output document and optionally dispatches a hospital webhook when the order is hospital-linked.",
        "operationId": "share_document_api_v1_orders__order_id__share_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "x-order-access-token",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Order-Access-Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ShareRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Share token, expiry, and hospital-facing share URL.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Share Document Api V1 Orders  Order Id  Share Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}/doctor-review-requests": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Request a paid platform doctor review",
        "description": "Records a patient-paid doctor review request for a completed packet. Payment is currently captured through the local demo payment path.",
        "operationId": "request_doctor_review_api_v1_orders__order_id__doctor_review_requests_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "x-order-access-token",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Order-Access-Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DoctorReviewRequestCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The paid doctor review request and its current workflow status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DoctorReviewRequestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orders/{order_id}/review-request": {
      "post": {
        "tags": [
          "orders"
        ],
        "summary": "Request manual follow-up on an order",
        "description": "Lets the patient or internal reviewers flag a case for additional human follow-up without changing the current order status.",
        "operationId": "request_manual_review_api_v1_orders__order_id__review_request_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Confirmation that the follow-up request was recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Request Manual Review Api V1 Orders  Order Id  Review Request Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/review/queue": {
      "get": {
        "tags": [
          "review"
        ],
        "summary": "Get Review Queue",
        "operationId": "get_review_queue_api_v1_review_queue_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/OrderResponse"
                  },
                  "type": "array",
                  "title": "Response Get Review Queue Api V1 Review Queue Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v1/review/{order_id}/claim": {
      "post": {
        "tags": [
          "review"
        ],
        "summary": "Claim Review Order",
        "operationId": "claim_review_order_api_v1_review__order_id__claim_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/review/{order_id}/data": {
      "get": {
        "tags": [
          "review"
        ],
        "summary": "Get Review Data",
        "operationId": "get_review_data_api_v1_review__order_id__data_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/review/{order_id}/ips": {
      "patch": {
        "tags": [
          "review"
        ],
        "summary": "Update Ips",
        "operationId": "update_ips_api_v1_review__order_id__ips_patch",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IPSUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/review/{order_id}/approve": {
      "post": {
        "tags": [
          "review"
        ],
        "summary": "Approve Review",
        "operationId": "approve_review_api_v1_review__order_id__approve_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/review/{order_id}/reject": {
      "post": {
        "tags": [
          "review"
        ],
        "summary": "Reject Review",
        "operationId": "reject_review_api_v1_review__order_id__reject_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReviewDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/translation/queue": {
      "get": {
        "tags": [
          "translation"
        ],
        "summary": "Get Translation Queue",
        "operationId": "get_translation_queue_api_v1_translation_queue_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TranslationOrderResponse"
                  },
                  "type": "array",
                  "title": "Response Get Translation Queue Api V1 Translation Queue Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v1/translation/orders/{order_id}": {
      "get": {
        "tags": [
          "translation"
        ],
        "summary": "Get Translation Order",
        "operationId": "get_translation_order_api_v1_translation_orders__order_id__get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranslationOrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/translation/orders/{order_id}/files/{file_id}/preview": {
      "get": {
        "tags": [
          "translation"
        ],
        "summary": "Preview Translation Source File",
        "operationId": "preview_translation_source_file_api_v1_translation_orders__order_id__files__file_id__preview_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "File Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/admin/dashboard": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Get Dashboard",
        "operationId": "get_dashboard_api_v1_admin_dashboard_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v1/admin/orders": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Get Admin Orders",
        "operationId": "get_admin_orders_api_v1_admin_orders_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OrderResponse"
                  },
                  "title": "Response Get Admin Orders Api V1 Admin Orders Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/admin/partner-leads": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Get Partner Leads",
        "operationId": "get_partner_leads_api_v1_admin_partner_leads_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^(new|contacted|qualified|closed)$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "name": "assignee",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Assignee"
            }
          },
          {
            "name": "pilot_stage",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^(submitted|discovery|demo|pilot|proposal|won|lost)$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Pilot Stage"
            }
          },
          {
            "name": "intent_level",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^(exploring|active|urgent)$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Intent Level"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Page Size"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerLeadListResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/admin/partner-leads/{lead_id}": {
      "patch": {
        "tags": [
          "admin"
        ],
        "summary": "Patch Partner Lead Status",
        "operationId": "patch_partner_lead_status_api_v1_admin_partner_leads__lead_id__patch",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "lead_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Lead Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerLeadUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerLeadAdminItem"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/admin/compliance-requests": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Get Compliance Requests",
        "operationId": "get_compliance_requests_api_v1_admin_compliance_requests_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Search"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^(submitted|triaged|in_review|resolved|closed)$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "name": "request_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^(deletion|correction|privacy|billing|pilot|other)$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Request Type"
            }
          },
          {
            "name": "assignee",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Assignee"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^(standard|priority|urgent)$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          },
          {
            "name": "due_bucket",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^(overdue|today)$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Due Bucket"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 20,
              "title": "Page Size"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComplianceRequestListResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/admin/compliance-requests/{request_id}": {
      "patch": {
        "tags": [
          "admin"
        ],
        "summary": "Patch Compliance Request Status",
        "operationId": "patch_compliance_request_status_api_v1_admin_compliance_requests__request_id__patch",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Request Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComplianceRequestUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComplianceRequestAdminItem"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/admin/orders/{order_id}/status": {
      "patch": {
        "tags": [
          "admin"
        ],
        "summary": "Patch Order Status",
        "operationId": "patch_order_status_api_v1_admin_orders__order_id__status_patch",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "status_value",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Status Value"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/admin/ai/prompts": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Get Prompts",
        "operationId": "get_prompts_api_v1_admin_ai_prompts_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Post Prompt",
        "operationId": "post_prompt_api_v1_admin_ai_prompts_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromptCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v1/admin/ai/prompts/{prompt_id}/test": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Test Prompt",
        "operationId": "test_prompt_api_v1_admin_ai_prompts__prompt_id__test_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "prompt_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Prompt Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PromptTestRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/admin/finance/summary": {
      "get": {
        "tags": [
          "admin"
        ],
        "summary": "Get Finance",
        "operationId": "get_finance_api_v1_admin_finance_summary_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FinanceSummaryResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v1/admin/orders/{order_id}/refund": {
      "post": {
        "tags": [
          "admin"
        ],
        "summary": "Refund Admin Order",
        "operationId": "refund_admin_order_api_v1_admin_orders__order_id__refund_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefundRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/trigger-upload": {
      "post": {
        "tags": [
          "hospital"
        ],
        "summary": "Create a hospital-linked upload invitation",
        "description": "Creates a new order scoped to the resolved hospital integration and dispatches an upload invitation webhook with the patient upload URL.",
        "operationId": "trigger_hospital_upload_api_v1_hospital_trigger_upload_post",
        "parameters": [
          {
            "name": "x-hospital-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Hospital-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HospitalTriggerRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created order ID, hospital ID, upload URL, and initial webhook delivery record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Trigger Hospital Upload Api V1 Hospital Trigger Upload Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/orders/{order_id}/dispatch-webhook": {
      "post": {
        "tags": [
          "hospital"
        ],
        "summary": "Dispatch a packet-ready webhook to a hospital",
        "description": "Delivers the current share URL to the hospital integration endpoint after reviewer-approved output documents exist.",
        "operationId": "dispatch_hospital_packet_webhook_api_v1_hospital_orders__order_id__dispatch_webhook_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          },
          {
            "name": "force",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Force"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order ID, share URL, and the webhook delivery attempt record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Dispatch Hospital Packet Webhook Api V1 Hospital Orders  Order Id  Dispatch Webhook Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/orders/{order_id}/webhook-deliveries": {
      "get": {
        "tags": [
          "hospital"
        ],
        "summary": "List webhook delivery history for a hospital-linked order",
        "description": "Returns prior packet-ready, packet-shared, or upload-invitation deliveries for the specified hospital-linked order.",
        "operationId": "get_hospital_webhook_history_api_v1_hospital_orders__order_id__webhook_deliveries_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook delivery history for the order.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/HospitalWebhookDeliveryResponse"
                  },
                  "title": "Response Get Hospital Webhook History Api V1 Hospital Orders  Order Id  Webhook Deliveries Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/webhooks/{delivery_id}/retry": {
      "post": {
        "tags": [
          "hospital"
        ],
        "summary": "Retry a specific hospital webhook delivery",
        "description": "Forces an immediate re-delivery attempt for a known webhook delivery record when the requester has access to the related hospital scope.",
        "operationId": "retry_hospital_webhook_api_v1_hospital_webhooks__delivery_id__retry_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "delivery_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Delivery Id"
            }
          },
          {
            "name": "force",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": true,
              "title": "Force"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The updated webhook delivery record after the retry attempt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HospitalWebhookDeliveryResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/webhooks/actions/retry-due": {
      "post": {
        "tags": [
          "hospital"
        ],
        "summary": "Retry due hospital webhooks in batch",
        "description": "Sweeps due webhook retries for the current hospital scope or the full ops scope and returns the deliveries retried in this batch.",
        "operationId": "retry_due_hospital_webhooks_endpoint_api_v1_hospital_webhooks_actions_retry_due_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 25,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Batch retry result including retried deliveries.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HospitalWebhookRetryBatchResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/patients": {
      "get": {
        "tags": [
          "hospital"
        ],
        "summary": "Hospital Patients",
        "operationId": "hospital_patients_api_v1_hospital_patients_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/OrderResponse"
                  },
                  "type": "array",
                  "title": "Response Hospital Patients Api V1 Hospital Patients Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v1/hospital/patients/{token}": {
      "get": {
        "tags": [
          "hospital"
        ],
        "summary": "Resolve a secure hospital share token",
        "description": "Returns the shared order context and download path for a valid hospital share token.",
        "operationId": "shared_patient_packet_api_v1_hospital_patients__token__get",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved order context for the provided share token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SharedPacketResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/patients/{token}/preview/{document_id}": {
      "get": {
        "tags": [
          "hospital"
        ],
        "summary": "Preview a hospital-shared packet document",
        "description": "Streams a shared packet document inline for controlled doctor viewing without enabling a file download workflow.",
        "operationId": "preview_shared_patient_document_api_v1_hospital_patients__token__preview__document_id__get",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token"
            }
          },
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Document Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/patients/{token}/doctor-review-requests/{request_id}/accept": {
      "post": {
        "tags": [
          "hospital"
        ],
        "summary": "Accept a doctor review request",
        "description": "Lets a doctor with a valid shared packet token accept an open paid review request.",
        "operationId": "accept_shared_patient_doctor_review_request_api_v1_hospital_patients__token__doctor_review_requests__request_id__accept_post",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token"
            }
          },
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Request Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DoctorReviewAcceptRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DoctorReviewRequestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/patients/{token}/doctor-notes": {
      "post": {
        "tags": [
          "hospital"
        ],
        "summary": "Create a doctor review note from a shared packet",
        "description": "Allows an authorized doctor viewer to leave a reference note. The note is retained with the patient case and is not a formal diagnosis or prescription.",
        "operationId": "create_shared_patient_doctor_note_api_v1_hospital_patients__token__doctor_notes_post",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DoctorReviewNoteCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DoctorReviewNoteResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/patients/{token}/download/{document_id}": {
      "get": {
        "tags": [
          "hospital"
        ],
        "summary": "Download a hospital-shared packet document",
        "description": "Downloads a shared packet document using the hospital share token rather than the patient portal order download path.",
        "operationId": "download_shared_patient_document_api_v1_hospital_patients__token__download__document_id__get",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Token"
            }
          },
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Document Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/hospital/orders/{order_id}/fhir-bundle": {
      "get": {
        "tags": [
          "hospital"
        ],
        "summary": "Export a minimal FHIR bundle for a reviewed order",
        "description": "Builds a conservative hospital-facing FHIR Bundle from the current order and IPS record after reviewer QA.",
        "operationId": "export_order_fhir_bundle_api_v1_hospital_orders__order_id__fhir_bundle_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Order Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "FHIR Bundle JSON generated from the order and IPS record.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Export Order Fhir Bundle Api V1 Hospital Orders  Order Id  Fhir Bundle Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/public/partner-leads": {
      "post": {
        "tags": [
          "public"
        ],
        "summary": "Submit a partner lead from the public site",
        "description": "Creates a partner inquiry record, preserves source context, and triggers follow-up notifications for demo review.",
        "operationId": "create_partner_lead_api_v1_public_partner_leads_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PartnerLeadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The created lead ID plus the public-facing confirmation message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PartnerLeadResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/public/compliance-requests": {
      "post": {
        "tags": [
          "public"
        ],
        "summary": "Submit a privacy, billing, or compliance request",
        "description": "Creates a request for deletion, correction, privacy, billing, partner review, or other follow-up.",
        "operationId": "create_compliance_request_api_v1_public_compliance_requests_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComplianceRequestCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The created request ID plus the public-facing confirmation message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComplianceRequestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AITaskResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "task_type": {
            "type": "string",
            "title": "Task Type"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "model_used": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Used"
          },
          "prompt_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt Version"
          },
          "result_json": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Result Json"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "task_type",
          "status",
          "created_at"
        ],
        "title": "AITaskResponse"
      },
      "AuditResponse": {
        "properties": {
          "action": {
            "type": "string",
            "title": "Action"
          },
          "entity_type": {
            "type": "string",
            "title": "Entity Type"
          },
          "entity_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entity Id"
          },
          "request_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Request Id"
          },
          "new_data": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Data"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "action",
          "entity_type",
          "created_at"
        ],
        "title": "AuditResponse"
      },
      "Body_upload_order_files_api_v1_orders__order_id__files_post": {
        "properties": {
          "uploads": {
            "items": {
              "type": "string",
              "contentMediaType": "application/octet-stream"
            },
            "type": "array",
            "title": "Uploads"
          }
        },
        "type": "object",
        "required": [
          "uploads"
        ],
        "title": "Body_upload_order_files_api_v1_orders__order_id__files_post"
      },
      "ComplianceRequestActivityItem": {
        "properties": {
          "timestamp": {
            "type": "string",
            "title": "Timestamp"
          },
          "actor": {
            "type": "string",
            "title": "Actor"
          },
          "action": {
            "type": "string",
            "title": "Action"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          }
        },
        "type": "object",
        "required": [
          "timestamp",
          "actor",
          "action",
          "label"
        ],
        "title": "ComplianceRequestActivityItem"
      },
      "ComplianceRequestAdminItem": {
        "properties": {
          "request_id": {
            "type": "string",
            "title": "Request Id"
          },
          "submitted_at": {
            "type": "string",
            "title": "Submitted At"
          },
          "request_type": {
            "type": "string",
            "title": "Request Type"
          },
          "requester_name": {
            "type": "string",
            "title": "Requester Name"
          },
          "requester_email": {
            "type": "string",
            "title": "Requester Email"
          },
          "requester_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Requester Phone"
          },
          "relationship_to_patient": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Relationship To Patient"
          },
          "patient_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Patient Name"
          },
          "order_reference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Order Reference"
          },
          "jurisdiction": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Jurisdiction"
          },
          "details": {
            "type": "string",
            "title": "Details"
          },
          "preferred_resolution": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preferred Resolution"
          },
          "source_host": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Host"
          },
          "lifecycle_status": {
            "type": "string",
            "title": "Lifecycle Status",
            "default": "submitted"
          },
          "severity": {
            "type": "string",
            "title": "Severity",
            "default": "standard"
          },
          "assignee": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assignee"
          },
          "follow_up_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Follow Up Note"
          },
          "next_action_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Action At"
          },
          "last_updated_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Updated By"
          },
          "status_updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Updated At"
          },
          "alert_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alert Status"
          },
          "alert_channel": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alert Channel"
          },
          "alert_detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alert Detail"
          },
          "notification_log": {
            "items": {
              "$ref": "#/components/schemas/ComplianceRequestNotificationItem"
            },
            "type": "array",
            "title": "Notification Log"
          },
          "activity_log": {
            "items": {
              "$ref": "#/components/schemas/ComplianceRequestActivityItem"
            },
            "type": "array",
            "title": "Activity Log"
          }
        },
        "type": "object",
        "required": [
          "request_id",
          "submitted_at",
          "request_type",
          "requester_name",
          "requester_email",
          "details"
        ],
        "title": "ComplianceRequestAdminItem"
      },
      "ComplianceRequestCreate": {
        "properties": {
          "request_type": {
            "type": "string",
            "pattern": "^(deletion|correction|privacy|billing|pilot|other)$",
            "title": "Request Type"
          },
          "requester_name": {
            "type": "string",
            "maxLength": 120,
            "minLength": 2,
            "title": "Requester Name"
          },
          "requester_email": {
            "type": "string",
            "format": "email",
            "title": "Requester Email"
          },
          "requester_phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Requester Phone"
          },
          "relationship_to_patient": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ],
            "title": "Relationship To Patient"
          },
          "patient_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Patient Name"
          },
          "order_reference": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Order Reference"
          },
          "jurisdiction": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ],
            "title": "Jurisdiction"
          },
          "details": {
            "type": "string",
            "maxLength": 2000,
            "minLength": 12,
            "title": "Details"
          },
          "preferred_resolution": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ],
            "title": "Preferred Resolution"
          }
        },
        "type": "object",
        "required": [
          "request_type",
          "requester_name",
          "requester_email",
          "details"
        ],
        "title": "ComplianceRequestCreate",
        "example": {
          "details": "The uploaded passport name and the generated case packet use different spelling. Please correct before hospital sharing.",
          "jurisdiction": "Australia",
          "order_reference": "MDB-240518-0012",
          "patient_name": "Li Hua",
          "preferred_resolution": "Confirm the corrected spelling by email before reissuing documents.",
          "relationship_to_patient": "Self",
          "request_type": "correction",
          "requester_email": "li.hua@example.com",
          "requester_name": "Li Hua",
          "requester_phone": "+61-400-222-333"
        }
      },
      "ComplianceRequestListResponse": {
        "properties": {
          "summary": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "Summary"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/ComplianceRequestAdminItem"
            },
            "type": "array",
            "title": "Items"
          },
          "page": {
            "type": "integer",
            "title": "Page"
          },
          "page_size": {
            "type": "integer",
            "title": "Page Size"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "total_pages": {
            "type": "integer",
            "title": "Total Pages"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "page",
          "page_size",
          "total",
          "total_pages",
          "has_more"
        ],
        "title": "ComplianceRequestListResponse"
      },
      "ComplianceRequestNotificationItem": {
        "properties": {
          "attempted_at": {
            "type": "string",
            "title": "Attempted At"
          },
          "channel": {
            "type": "string",
            "title": "Channel"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "detail": {
            "type": "string",
            "title": "Detail"
          }
        },
        "type": "object",
        "required": [
          "attempted_at",
          "channel",
          "status",
          "detail"
        ],
        "title": "ComplianceRequestNotificationItem"
      },
      "ComplianceRequestResponse": {
        "properties": {
          "request_id": {
            "type": "string",
            "title": "Request Id"
          },
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "request_id",
          "message"
        ],
        "title": "ComplianceRequestResponse"
      },
      "ComplianceRequestUpdateRequest": {
        "properties": {
          "status": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(submitted|triaged|in_review|resolved|closed)$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "assignee": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "Assignee"
          },
          "follow_up_note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Follow Up Note"
          },
          "next_action_at": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Action At"
          },
          "severity": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(standard|priority|urgent)$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity"
          }
        },
        "type": "object",
        "title": "ComplianceRequestUpdateRequest"
      },
      "DemoLoginRequest": {
        "properties": {
          "role": {
            "$ref": "#/components/schemas/UserRole"
          },
          "otp_code": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 6,
                "minLength": 6
              },
              {
                "type": "null"
              }
            ],
            "title": "Otp Code"
          }
        },
        "type": "object",
        "required": [
          "role"
        ],
        "title": "DemoLoginRequest",
        "example": {
          "role": "reviewer"
        }
      },
      "DoctorReviewAcceptRequest": {
        "properties": {
          "doctor_name": {
            "type": "string",
            "maxLength": 120,
            "minLength": 2,
            "title": "Doctor Name"
          },
          "doctor_email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "null"
              }
            ],
            "title": "Doctor Email"
          }
        },
        "type": "object",
        "required": [
          "doctor_name"
        ],
        "title": "DoctorReviewAcceptRequest"
      },
      "DoctorReviewNoteCreate": {
        "properties": {
          "doctor_review_request_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 36
              },
              {
                "type": "null"
              }
            ],
            "title": "Doctor Review Request Id"
          },
          "doctor_name": {
            "type": "string",
            "maxLength": 120,
            "minLength": 2,
            "title": "Doctor Name"
          },
          "doctor_email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "null"
              }
            ],
            "title": "Doctor Email"
          },
          "review_note": {
            "type": "string",
            "maxLength": 5000,
            "minLength": 10,
            "title": "Review Note"
          },
          "missing_information": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 3000
              },
              {
                "type": "null"
              }
            ],
            "title": "Missing Information"
          },
          "recommended_next_steps": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 3000
              },
              {
                "type": "null"
              }
            ],
            "title": "Recommended Next Steps"
          },
          "referral_suggestion": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Referral Suggestion"
          }
        },
        "type": "object",
        "required": [
          "doctor_name",
          "review_note"
        ],
        "title": "DoctorReviewNoteCreate",
        "example": {
          "doctor_email": "amelia.chen@examplehospital.org",
          "doctor_name": "Dr. Amelia Chen",
          "missing_information": "Please add the latest pathology addendum if available.",
          "recommended_next_steps": "Route to oncology intake and confirm whether recent imaging exists.",
          "referral_suggestion": "Medical oncology program.",
          "review_note": "The packet is readable enough for intake review."
        }
      },
      "DoctorReviewNoteResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "doctor_review_request_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Doctor Review Request Id"
          },
          "doctor_name": {
            "type": "string",
            "title": "Doctor Name"
          },
          "doctor_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Doctor Email"
          },
          "review_note": {
            "type": "string",
            "title": "Review Note"
          },
          "missing_information": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Missing Information"
          },
          "recommended_next_steps": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recommended Next Steps"
          },
          "referral_suggestion": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Referral Suggestion"
          },
          "is_formal_medical_opinion": {
            "type": "boolean",
            "title": "Is Formal Medical Opinion",
            "default": false
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "doctor_name",
          "review_note",
          "created_at",
          "updated_at"
        ],
        "title": "DoctorReviewNoteResponse"
      },
      "DoctorReviewRequestCreate": {
        "properties": {
          "request_note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Request Note"
          },
          "payment_method": {
            "type": "string",
            "maxLength": 30,
            "title": "Payment Method",
            "default": "local-demo"
          }
        },
        "type": "object",
        "title": "DoctorReviewRequestCreate"
      },
      "DoctorReviewRequestResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "payment_status": {
            "type": "string",
            "title": "Payment Status"
          },
          "payment_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Method"
          },
          "payment_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Ref"
          },
          "amount": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Amount"
          },
          "currency": {
            "type": "string",
            "title": "Currency"
          },
          "request_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Request Note"
          },
          "requested_by_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Requested By Email"
          },
          "accepted_doctor_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accepted Doctor Name"
          },
          "accepted_doctor_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accepted Doctor Email"
          },
          "accepted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Accepted At"
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "status",
          "payment_status",
          "amount",
          "currency",
          "created_at",
          "updated_at"
        ],
        "title": "DoctorReviewRequestResponse"
      },
      "DocumentResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "doc_type": {
            "$ref": "#/components/schemas/OutputDocumentType"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "share_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Share Url"
          },
          "share_active": {
            "type": "boolean",
            "title": "Share Active",
            "default": false
          },
          "share_expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Share Expires At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "doc_type",
          "created_at"
        ],
        "title": "DocumentResponse"
      },
      "FileResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "original_name": {
            "type": "string",
            "title": "Original Name"
          },
          "file_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "File Type"
          },
          "doc_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Doc Category"
          },
          "page_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Page Count"
          },
          "file_size": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "File Size"
          },
          "is_processed": {
            "type": "boolean",
            "title": "Is Processed"
          },
          "processing_metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Processing Metadata"
          }
        },
        "type": "object",
        "required": [
          "id",
          "original_name",
          "is_processed"
        ],
        "title": "FileResponse"
      },
      "FinancePackageMixItem": {
        "properties": {
          "package_type": {
            "$ref": "#/components/schemas/PackageType"
          },
          "order_count": {
            "type": "integer",
            "title": "Order Count"
          },
          "completed_orders": {
            "type": "integer",
            "title": "Completed Orders"
          },
          "recognized_revenue": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Recognized Revenue"
          },
          "average_turnaround_hours": {
            "type": "number",
            "title": "Average Turnaround Hours"
          }
        },
        "type": "object",
        "required": [
          "package_type",
          "order_count",
          "completed_orders",
          "recognized_revenue",
          "average_turnaround_hours"
        ],
        "title": "FinancePackageMixItem"
      },
      "FinanceSummaryResponse": {
        "properties": {
          "total_revenue": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Total Revenue"
          },
          "refunded_revenue": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Refunded Revenue"
          },
          "active_orders": {
            "type": "integer",
            "title": "Active Orders"
          },
          "completed_orders": {
            "type": "integer",
            "title": "Completed Orders"
          },
          "open_pipeline_value": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Open Pipeline Value"
          },
          "average_completed_order_value": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Average Completed Order Value"
          },
          "completion_rate": {
            "type": "number",
            "title": "Completion Rate"
          },
          "total_ai_cost_usd": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Total Ai Cost Usd"
          },
          "average_ai_cost_usd_per_completed_order": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Average Ai Cost Usd Per Completed Order"
          },
          "package_mix": {
            "items": {
              "$ref": "#/components/schemas/FinancePackageMixItem"
            },
            "type": "array",
            "title": "Package Mix"
          }
        },
        "type": "object",
        "required": [
          "total_revenue",
          "refunded_revenue",
          "active_orders",
          "completed_orders",
          "open_pipeline_value",
          "average_completed_order_value",
          "completion_rate",
          "total_ai_cost_usd",
          "average_ai_cost_usd_per_completed_order"
        ],
        "title": "FinanceSummaryResponse"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "HistoryResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/PatientOrderResponse"
            },
            "type": "array",
            "title": "Items"
          }
        },
        "type": "object",
        "required": [
          "items"
        ],
        "title": "HistoryResponse"
      },
      "HospitalTriggerRequest": {
        "properties": {
          "hospital_code": {
            "type": "string",
            "title": "Hospital Code"
          },
          "patient_name": {
            "type": "string",
            "title": "Patient Name"
          },
          "appointment_date": {
            "type": "string",
            "title": "Appointment Date"
          },
          "department": {
            "type": "string",
            "title": "Department"
          },
          "contact_email": {
            "type": "string",
            "format": "email",
            "title": "Contact Email"
          },
          "contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          }
        },
        "type": "object",
        "required": [
          "hospital_code",
          "patient_name",
          "appointment_date",
          "department",
          "contact_email"
        ],
        "title": "HospitalTriggerRequest",
        "example": {
          "appointment_date": "2026-05-12",
          "contact_email": "zhao.min@example.com",
          "contact_phone": "+61-410-888-000",
          "department": "Oncology",
          "hospital_code": "RPAH",
          "patient_name": "Zhao Min"
        }
      },
      "HospitalWebhookDeliveryResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "hospital_id": {
            "type": "string",
            "title": "Hospital Id"
          },
          "order_id": {
            "type": "string",
            "title": "Order Id"
          },
          "event": {
            "type": "string",
            "title": "Event"
          },
          "idempotency_key": {
            "type": "string",
            "title": "Idempotency Key"
          },
          "delivery_status": {
            "type": "string",
            "title": "Delivery Status"
          },
          "ack_validated": {
            "type": "boolean",
            "title": "Ack Validated",
            "default": false
          },
          "attempt_count": {
            "type": "integer",
            "title": "Attempt Count",
            "default": 0
          },
          "response_status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Response Status Code"
          },
          "response_body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Response Body"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Error"
          },
          "first_attempted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Attempted At"
          },
          "last_attempted_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Attempted At"
          },
          "delivered_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delivered At"
          },
          "next_retry_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Retry At"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "hospital_id",
          "order_id",
          "event",
          "idempotency_key",
          "delivery_status",
          "created_at"
        ],
        "title": "HospitalWebhookDeliveryResponse"
      },
      "HospitalWebhookRetryBatchResponse": {
        "properties": {
          "retried_count": {
            "type": "integer",
            "title": "Retried Count"
          },
          "deliveries": {
            "items": {
              "$ref": "#/components/schemas/HospitalWebhookDeliveryResponse"
            },
            "type": "array",
            "title": "Deliveries"
          }
        },
        "type": "object",
        "required": [
          "retried_count"
        ],
        "title": "HospitalWebhookRetryBatchResponse"
      },
      "IPSRecordResponse": {
        "properties": {
          "diagnoses": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Diagnoses"
          },
          "medications": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Medications"
          },
          "allergies": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Allergies"
          },
          "surgeries": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Surgeries"
          },
          "lab_results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Lab Results"
          },
          "imaging": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Imaging"
          },
          "immunizations": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Immunizations"
          },
          "vitals": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Vitals"
          },
          "social_history": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Social History"
          },
          "alerts": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Alerts"
          },
          "patient_story": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Patient Story"
          },
          "discharge_summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Discharge Summary"
          },
          "functional_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Functional Status"
          },
          "pregnancy_history": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pregnancy History"
          },
          "confidence_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence Score"
          },
          "reviewer_edits": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewer Edits"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At"
          }
        },
        "type": "object",
        "title": "IPSRecordResponse"
      },
      "IPSUpdateRequest": {
        "properties": {
          "diagnoses": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Diagnoses"
          },
          "medications": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Medications"
          },
          "allergies": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allergies"
          },
          "surgeries": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Surgeries"
          },
          "lab_results": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lab Results"
          },
          "imaging": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Imaging"
          },
          "immunizations": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Immunizations"
          },
          "vitals": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vitals"
          },
          "social_history": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Social History"
          },
          "alerts": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alerts"
          },
          "patient_story": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Patient Story"
          },
          "discharge_summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Discharge Summary"
          },
          "functional_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Functional Status"
          },
          "pregnancy_history": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pregnancy History"
          },
          "confidence_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence Score"
          },
          "reviewer_edits": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewer Edits"
          }
        },
        "type": "object",
        "title": "IPSUpdateRequest",
        "example": {
          "allergies": [
            {
              "name": "Penicillin",
              "reaction": "Rash"
            }
          ],
          "confidence_score": 0.84,
          "medications": [
            {
              "dose": "500 mg twice daily",
              "name": "Metformin"
            }
          ],
          "patient_story": "Patient is seeking second-opinion review before overseas oncology consult.",
          "reviewer_edits": {
            "release_checklist": {
              "ai_extraction_checked": true,
              "alerts_assessed": false,
              "authorization_confirmed": true,
              "ready_for_handoff": false,
              "source_documents_checked": true
            },
            "review_notes": "Medication list checked against source discharge summary.",
            "risk_summary": "Confirm exact allergy severity before hospital handoff."
          },
          "surgeries": [
            {
              "date": "2023-09",
              "name": "Laparoscopic appendectomy"
            }
          ]
        }
      },
      "LoginRequest": {
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 255,
            "minLength": 3,
            "title": "Email"
          },
          "password": {
            "type": "string",
            "title": "Password"
          },
          "otp_code": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 6,
                "minLength": 6
              },
              {
                "type": "null"
              }
            ],
            "title": "Otp Code"
          }
        },
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "title": "LoginRequest",
        "example": {
          "email": "ops@meddossier.local",
          "otp_code": "123456",
          "password": "MedDossier123!"
        }
      },
      "OrderCreate": {
        "properties": {
          "patient_name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 2,
            "title": "Patient Name"
          },
          "contact_email": {
            "type": "string",
            "format": "email",
            "title": "Contact Email"
          },
          "contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          },
          "nationality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Nationality"
          },
          "purpose": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Purpose"
          },
          "target_hospital": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Hospital"
          },
          "target_department": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Department"
          },
          "appointment_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Appointment Date"
          },
          "authorization_scope": {
            "type": "string",
            "pattern": "^(records_only|records_and_hospital_contact|records_hospital_and_family_updates)$",
            "title": "Authorization Scope",
            "default": "records_and_hospital_contact"
          },
          "authorization_confirmed": {
            "type": "boolean",
            "title": "Authorization Confirmed",
            "default": false
          },
          "authorized_contact_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 100
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Name"
          },
          "authorized_contact_relationship": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Relationship"
          },
          "authorized_contact_phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Phone"
          },
          "authorization_notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization Notes"
          },
          "package_type": {
            "$ref": "#/components/schemas/PackageType"
          },
          "payment_method": {
            "type": "string",
            "title": "Payment Method",
            "default": "stripe"
          }
        },
        "type": "object",
        "required": [
          "patient_name",
          "contact_email",
          "package_type"
        ],
        "title": "OrderCreate",
        "example": {
          "appointment_date": "2026-05-08",
          "authorization_confirmed": true,
          "authorization_notes": "Hospital contact approved for scheduling clarification only.",
          "authorization_scope": "records_and_hospital_contact",
          "authorized_contact_name": "Chen Wei",
          "authorized_contact_phone": "+61-400-555-888",
          "authorized_contact_relationship": "Brother",
          "contact_email": "lin.chen@example.com",
          "contact_phone": "+61-400-123-456",
          "nationality": "China",
          "package_type": "standard",
          "patient_name": "Lin Chen",
          "payment_method": "stripe",
          "purpose": "Second opinion for liver surgery history",
          "target_department": "Hepatobiliary Surgery",
          "target_hospital": "Prince of Wales Hospital"
        }
      },
      "OrderCreateResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "order_no": {
            "type": "string",
            "title": "Order No"
          },
          "patient_name": {
            "type": "string",
            "title": "Patient Name"
          },
          "contact_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Email"
          },
          "contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          },
          "nationality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Nationality"
          },
          "language_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Language Code"
          },
          "purpose": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Purpose"
          },
          "target_hospital": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Hospital"
          },
          "target_department": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Department"
          },
          "hospital_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hospital Id"
          },
          "appointment_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Appointment Date"
          },
          "authorization_scope": {
            "type": "string",
            "title": "Authorization Scope",
            "default": "records_and_hospital_contact"
          },
          "authorization_status": {
            "type": "string",
            "title": "Authorization Status",
            "default": "pending"
          },
          "authorization_confirmed": {
            "type": "boolean",
            "title": "Authorization Confirmed",
            "default": false
          },
          "authorization_confirmed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization Confirmed At"
          },
          "authorized_contact_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Name"
          },
          "authorized_contact_relationship": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Relationship"
          },
          "authorized_contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Phone"
          },
          "authorization_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization Notes"
          },
          "hospital_contact_status": {
            "type": "string",
            "title": "Hospital Contact Status",
            "default": "not_started"
          },
          "hospital_contact_last_event_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hospital Contact Last Event At"
          },
          "package_type": {
            "$ref": "#/components/schemas/PackageType"
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "priority": {
            "type": "integer",
            "title": "Priority"
          },
          "amount": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Amount"
          },
          "currency": {
            "type": "string",
            "title": "Currency"
          },
          "payment_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Method"
          },
          "paid_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paid At"
          },
          "deadline_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deadline At"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "estimated_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Completed At"
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          },
          "files": {
            "items": {
              "$ref": "#/components/schemas/FileResponse"
            },
            "type": "array",
            "title": "Files"
          },
          "documents": {
            "items": {
              "$ref": "#/components/schemas/PortalDocumentResponse"
            },
            "type": "array",
            "title": "Documents"
          },
          "doctor_reviews": {
            "items": {
              "$ref": "#/components/schemas/DoctorReviewNoteResponse"
            },
            "type": "array",
            "title": "Doctor Reviews"
          },
          "doctor_review_requests": {
            "items": {
              "$ref": "#/components/schemas/DoctorReviewRequestResponse"
            },
            "type": "array",
            "title": "Doctor Review Requests"
          },
          "order_access_token": {
            "type": "string",
            "title": "Order Access Token"
          }
        },
        "type": "object",
        "required": [
          "id",
          "order_no",
          "patient_name",
          "package_type",
          "status",
          "priority",
          "amount",
          "currency",
          "created_at",
          "updated_at",
          "order_access_token"
        ],
        "title": "OrderCreateResponse"
      },
      "OrderPayRequest": {
        "properties": {
          "payment_method": {
            "type": "string",
            "title": "Payment Method",
            "default": "stripe"
          }
        },
        "type": "object",
        "title": "OrderPayRequest",
        "example": {
          "payment_method": "stripe"
        }
      },
      "OrderResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "order_no": {
            "type": "string",
            "title": "Order No"
          },
          "patient_name": {
            "type": "string",
            "title": "Patient Name"
          },
          "contact_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Email"
          },
          "contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          },
          "nationality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Nationality"
          },
          "language_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Language Code"
          },
          "purpose": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Purpose"
          },
          "target_hospital": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Hospital"
          },
          "target_department": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Department"
          },
          "hospital_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hospital Id"
          },
          "appointment_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Appointment Date"
          },
          "authorization_scope": {
            "type": "string",
            "title": "Authorization Scope",
            "default": "records_and_hospital_contact"
          },
          "authorization_status": {
            "type": "string",
            "title": "Authorization Status",
            "default": "pending"
          },
          "authorization_confirmed": {
            "type": "boolean",
            "title": "Authorization Confirmed",
            "default": false
          },
          "authorization_confirmed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization Confirmed At"
          },
          "authorized_contact_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Name"
          },
          "authorized_contact_relationship": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Relationship"
          },
          "authorized_contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Phone"
          },
          "authorization_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization Notes"
          },
          "hospital_contact_status": {
            "type": "string",
            "title": "Hospital Contact Status",
            "default": "not_started"
          },
          "hospital_contact_last_event_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hospital Contact Last Event At"
          },
          "package_type": {
            "$ref": "#/components/schemas/PackageType"
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "priority": {
            "type": "integer",
            "title": "Priority"
          },
          "amount": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Amount"
          },
          "currency": {
            "type": "string",
            "title": "Currency"
          },
          "payment_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Method"
          },
          "payment_ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Ref"
          },
          "paid_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paid At"
          },
          "deadline_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deadline At"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "estimated_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Completed At"
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          },
          "files": {
            "items": {
              "$ref": "#/components/schemas/FileResponse"
            },
            "type": "array",
            "title": "Files"
          },
          "documents": {
            "items": {
              "$ref": "#/components/schemas/DocumentResponse"
            },
            "type": "array",
            "title": "Documents"
          },
          "doctor_reviews": {
            "items": {
              "$ref": "#/components/schemas/DoctorReviewNoteResponse"
            },
            "type": "array",
            "title": "Doctor Reviews"
          },
          "doctor_review_requests": {
            "items": {
              "$ref": "#/components/schemas/DoctorReviewRequestResponse"
            },
            "type": "array",
            "title": "Doctor Review Requests"
          },
          "ips_record": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/IPSRecordResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "ai_tasks": {
            "items": {
              "$ref": "#/components/schemas/AITaskResponse"
            },
            "type": "array",
            "title": "Ai Tasks"
          },
          "audit_logs": {
            "items": {
              "$ref": "#/components/schemas/AuditResponse"
            },
            "type": "array",
            "title": "Audit Logs"
          }
        },
        "type": "object",
        "required": [
          "id",
          "order_no",
          "patient_name",
          "package_type",
          "status",
          "priority",
          "amount",
          "currency",
          "created_at",
          "updated_at"
        ],
        "title": "OrderResponse"
      },
      "OrderStatus": {
        "type": "string",
        "enum": [
          "created",
          "paid",
          "files_received",
          "processing",
          "reviewing",
          "generating",
          "completed",
          "failed",
          "refunded",
          "cancelled",
          "needs_info"
        ],
        "title": "OrderStatus"
      },
      "OutputDocumentType": {
        "type": "string",
        "enum": [
          "summary",
          "full_translation"
        ],
        "title": "OutputDocumentType"
      },
      "PackageType": {
        "type": "string",
        "enum": [
          "basic",
          "standard",
          "express",
          "complex"
        ],
        "title": "PackageType"
      },
      "PartnerLeadActivityItem": {
        "properties": {
          "timestamp": {
            "type": "string",
            "title": "Timestamp"
          },
          "actor": {
            "type": "string",
            "title": "Actor"
          },
          "action": {
            "type": "string",
            "title": "Action"
          },
          "label": {
            "type": "string",
            "title": "Label"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          }
        },
        "type": "object",
        "required": [
          "timestamp",
          "actor",
          "action",
          "label"
        ],
        "title": "PartnerLeadActivityItem"
      },
      "PartnerLeadAdminItem": {
        "properties": {
          "lead_id": {
            "type": "string",
            "title": "Lead Id"
          },
          "submitted_at": {
            "type": "string",
            "title": "Submitted At"
          },
          "organization_name": {
            "type": "string",
            "title": "Organization Name"
          },
          "contact_name": {
            "type": "string",
            "title": "Contact Name"
          },
          "contact_email": {
            "type": "string",
            "title": "Contact Email"
          },
          "contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          },
          "organization_type": {
            "type": "string",
            "title": "Organization Type"
          },
          "monthly_case_volume": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Monthly Case Volume"
          },
          "lead_source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lead Source"
          },
          "decision_timeline": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Timeline"
          },
          "intent_level": {
            "type": "string",
            "title": "Intent Level",
            "default": "exploring"
          },
          "pilot_stage": {
            "type": "string",
            "title": "Pilot Stage",
            "default": "submitted"
          },
          "lead_score": {
            "type": "integer",
            "title": "Lead Score",
            "default": 0
          },
          "priority_tier": {
            "type": "string",
            "title": "Priority Tier",
            "default": "nurture"
          },
          "follow_up_due_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Follow Up Due At"
          },
          "recommended_next_action": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recommended Next Action"
          },
          "primary_use_case": {
            "type": "string",
            "title": "Primary Use Case"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          },
          "source_host": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Host"
          },
          "source_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Path"
          },
          "lifecycle_status": {
            "type": "string",
            "title": "Lifecycle Status",
            "default": "new"
          },
          "status_updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Updated At"
          },
          "last_updated_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Updated By"
          },
          "assignee": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Assignee"
          },
          "follow_up_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Follow Up Note"
          },
          "next_action_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Action At"
          },
          "alert_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alert Status"
          },
          "alert_channel": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alert Channel"
          },
          "alert_detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alert Detail"
          },
          "notification_log": {
            "items": {
              "$ref": "#/components/schemas/PartnerLeadNotificationItem"
            },
            "type": "array",
            "title": "Notification Log"
          },
          "activity_log": {
            "items": {
              "$ref": "#/components/schemas/PartnerLeadActivityItem"
            },
            "type": "array",
            "title": "Activity Log"
          }
        },
        "type": "object",
        "required": [
          "lead_id",
          "submitted_at",
          "organization_name",
          "contact_name",
          "contact_email",
          "organization_type",
          "primary_use_case"
        ],
        "title": "PartnerLeadAdminItem"
      },
      "PartnerLeadListResponse": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/PartnerLeadAdminItem"
            },
            "type": "array",
            "title": "Items"
          },
          "page": {
            "type": "integer",
            "title": "Page"
          },
          "page_size": {
            "type": "integer",
            "title": "Page Size"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "total_pages": {
            "type": "integer",
            "title": "Total Pages"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "page",
          "page_size",
          "total",
          "total_pages",
          "has_more"
        ],
        "title": "PartnerLeadListResponse"
      },
      "PartnerLeadNotificationItem": {
        "properties": {
          "attempted_at": {
            "type": "string",
            "title": "Attempted At"
          },
          "channel": {
            "type": "string",
            "title": "Channel"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "detail": {
            "type": "string",
            "title": "Detail"
          }
        },
        "type": "object",
        "required": [
          "attempted_at",
          "channel",
          "status",
          "detail"
        ],
        "title": "PartnerLeadNotificationItem"
      },
      "PartnerLeadRequest": {
        "properties": {
          "organization_name": {
            "type": "string",
            "maxLength": 200,
            "minLength": 2,
            "title": "Organization Name"
          },
          "contact_name": {
            "type": "string",
            "maxLength": 100,
            "minLength": 2,
            "title": "Contact Name"
          },
          "contact_email": {
            "type": "string",
            "format": "email",
            "title": "Contact Email"
          },
          "contact_phone": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          },
          "organization_type": {
            "type": "string",
            "maxLength": 80,
            "minLength": 2,
            "title": "Organization Type"
          },
          "monthly_case_volume": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 80
              },
              {
                "type": "null"
              }
            ],
            "title": "Monthly Case Volume"
          },
          "lead_source": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Lead Source"
          },
          "decision_timeline": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Timeline"
          },
          "intent_level": {
            "type": "string",
            "pattern": "^(exploring|active|urgent)$",
            "title": "Intent Level",
            "default": "exploring"
          },
          "primary_use_case": {
            "type": "string",
            "maxLength": 500,
            "minLength": 6,
            "title": "Primary Use Case"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          },
          "landing_page_url": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Landing Page Url"
          },
          "referrer_url": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Referrer Url"
          }
        },
        "type": "object",
        "required": [
          "organization_name",
          "contact_name",
          "contact_email",
          "organization_type",
          "primary_use_case"
        ],
        "title": "PartnerLeadRequest",
        "example": {
          "contact_email": "amelia.wong@example.org",
          "contact_name": "Dr. Amelia Wong",
          "contact_phone": "+61-2-9000-1000",
          "decision_timeline": "Demo review within 30 days",
          "intent_level": "active",
          "landing_page_url": "https://meddossier.com/partners?utm_source=linkedin&utm_campaign=q2-demo",
          "lead_source": "Website request demo",
          "monthly_case_volume": "30-50",
          "notes": "Interested in testing one GI oncology record handoff path.",
          "organization_name": "Harbour International Oncology Center",
          "organization_type": "Hospital international desk",
          "primary_use_case": "Need bilingual case packets for cross-border oncology referrals before specialist review.",
          "referrer_url": "https://www.linkedin.com/company/meddossier"
        }
      },
      "PartnerLeadResponse": {
        "properties": {
          "lead_id": {
            "type": "string",
            "title": "Lead Id"
          },
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "lead_id",
          "message"
        ],
        "title": "PartnerLeadResponse"
      },
      "PartnerLeadUpdateRequest": {
        "properties": {
          "status": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(new|contacted|qualified|closed)$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "follow_up_note": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "title": "Follow Up Note"
          },
          "next_action_at": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Action At"
          },
          "assignee": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "Assignee"
          },
          "lead_source": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Lead Source"
          },
          "decision_timeline": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Timeline"
          },
          "intent_level": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(exploring|active|urgent)$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent Level"
          },
          "pilot_stage": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(submitted|discovery|demo|pilot|proposal|won|lost)$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pilot Stage"
          },
          "claim_if_unassigned": {
            "type": "boolean",
            "title": "Claim If Unassigned",
            "default": false
          }
        },
        "type": "object",
        "title": "PartnerLeadUpdateRequest"
      },
      "PasswordResetConfirmRequest": {
        "properties": {
          "token": {
            "type": "string",
            "maxLength": 255,
            "minLength": 20,
            "title": "Token"
          },
          "new_password": {
            "type": "string",
            "maxLength": 128,
            "minLength": 8,
            "title": "New Password"
          }
        },
        "type": "object",
        "required": [
          "token",
          "new_password"
        ],
        "title": "PasswordResetConfirmRequest",
        "example": {
          "new_password": "MedDossier123!",
          "token": "reset-token-from-email"
        }
      },
      "PasswordResetConfirmResponse": {
        "properties": {
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "message"
        ],
        "title": "PasswordResetConfirmResponse"
      },
      "PasswordResetRequest": {
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 255,
            "minLength": 3,
            "title": "Email"
          }
        },
        "type": "object",
        "required": [
          "email"
        ],
        "title": "PasswordResetRequest",
        "example": {
          "email": "patient@meddossier.local"
        }
      },
      "PasswordResetRequestResponse": {
        "properties": {
          "message": {
            "type": "string",
            "title": "Message"
          },
          "email_delivery_status": {
            "type": "string",
            "title": "Email Delivery Status",
            "default": "queued"
          },
          "preview_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preview Url"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          }
        },
        "type": "object",
        "required": [
          "message"
        ],
        "title": "PasswordResetRequestResponse"
      },
      "PasswordResetTokenValidationResponse": {
        "properties": {
          "email_hint": {
            "type": "string",
            "title": "Email Hint"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "title": "Expires At"
          }
        },
        "type": "object",
        "required": [
          "email_hint",
          "expires_at"
        ],
        "title": "PasswordResetTokenValidationResponse"
      },
      "PatientOrderResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "order_no": {
            "type": "string",
            "title": "Order No"
          },
          "patient_name": {
            "type": "string",
            "title": "Patient Name"
          },
          "contact_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Email"
          },
          "contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          },
          "nationality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Nationality"
          },
          "language_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Language Code"
          },
          "purpose": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Purpose"
          },
          "target_hospital": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Hospital"
          },
          "target_department": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Department"
          },
          "hospital_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hospital Id"
          },
          "appointment_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Appointment Date"
          },
          "authorization_scope": {
            "type": "string",
            "title": "Authorization Scope",
            "default": "records_and_hospital_contact"
          },
          "authorization_status": {
            "type": "string",
            "title": "Authorization Status",
            "default": "pending"
          },
          "authorization_confirmed": {
            "type": "boolean",
            "title": "Authorization Confirmed",
            "default": false
          },
          "authorization_confirmed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization Confirmed At"
          },
          "authorized_contact_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Name"
          },
          "authorized_contact_relationship": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Relationship"
          },
          "authorized_contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorized Contact Phone"
          },
          "authorization_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization Notes"
          },
          "hospital_contact_status": {
            "type": "string",
            "title": "Hospital Contact Status",
            "default": "not_started"
          },
          "hospital_contact_last_event_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hospital Contact Last Event At"
          },
          "package_type": {
            "$ref": "#/components/schemas/PackageType"
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "priority": {
            "type": "integer",
            "title": "Priority"
          },
          "amount": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Amount"
          },
          "currency": {
            "type": "string",
            "title": "Currency"
          },
          "payment_method": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Method"
          },
          "paid_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paid At"
          },
          "deadline_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deadline At"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "estimated_completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Completed At"
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          },
          "files": {
            "items": {
              "$ref": "#/components/schemas/FileResponse"
            },
            "type": "array",
            "title": "Files"
          },
          "documents": {
            "items": {
              "$ref": "#/components/schemas/PortalDocumentResponse"
            },
            "type": "array",
            "title": "Documents"
          },
          "doctor_reviews": {
            "items": {
              "$ref": "#/components/schemas/DoctorReviewNoteResponse"
            },
            "type": "array",
            "title": "Doctor Reviews"
          },
          "doctor_review_requests": {
            "items": {
              "$ref": "#/components/schemas/DoctorReviewRequestResponse"
            },
            "type": "array",
            "title": "Doctor Review Requests"
          },
          "order_access_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Order Access Token"
          }
        },
        "type": "object",
        "required": [
          "id",
          "order_no",
          "patient_name",
          "package_type",
          "status",
          "priority",
          "amount",
          "currency",
          "created_at",
          "updated_at"
        ],
        "title": "PatientOrderResponse"
      },
      "PaymentResponse": {
        "properties": {
          "order_id": {
            "type": "string",
            "title": "Order Id"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "checkout_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Checkout Url"
          },
          "message": {
            "type": "string",
            "title": "Message"
          }
        },
        "type": "object",
        "required": [
          "order_id",
          "status",
          "message"
        ],
        "title": "PaymentResponse"
      },
      "PortalDocumentResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "doc_type": {
            "$ref": "#/components/schemas/OutputDocumentType"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "doc_type",
          "created_at"
        ],
        "title": "PortalDocumentResponse"
      },
      "PromptCreateRequest": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "version": {
            "type": "string",
            "title": "Version"
          },
          "language": {
            "type": "string",
            "title": "Language",
            "default": "all"
          },
          "task_type": {
            "type": "string",
            "title": "Task Type"
          },
          "content": {
            "type": "string",
            "title": "Content"
          },
          "is_active": {
            "type": "boolean",
            "title": "Is Active",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "name",
          "version",
          "task_type",
          "content"
        ],
        "title": "PromptCreateRequest"
      },
      "PromptTestRequest": {
        "properties": {
          "sample_text": {
            "type": "string",
            "title": "Sample Text"
          },
          "language": {
            "type": "string",
            "title": "Language",
            "default": "en"
          }
        },
        "type": "object",
        "required": [
          "sample_text"
        ],
        "title": "PromptTestRequest"
      },
      "RefreshRequest": {
        "properties": {
          "refresh_token": {
            "type": "string",
            "title": "Refresh Token"
          }
        },
        "type": "object",
        "required": [
          "refresh_token"
        ],
        "title": "RefreshRequest",
        "example": {
          "refresh_token": "demo-refresh-token"
        }
      },
      "RefundRequest": {
        "properties": {
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "type": "object",
        "title": "RefundRequest"
      },
      "ReviewDecisionRequest": {
        "properties": {
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notes"
          }
        },
        "type": "object",
        "title": "ReviewDecisionRequest",
        "example": {
          "notes": "Extraction reconciled against discharge summary and allergy sheet. Safe to hand off."
        }
      },
      "ReviewRequest": {
        "properties": {
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "type": "object",
        "title": "ReviewRequest",
        "example": {
          "reason": "Please double-check the medication timeline before hospital submission."
        }
      },
      "ShareRequest": {
        "properties": {
          "hours": {
            "type": "integer",
            "maximum": 168.0,
            "minimum": 1.0,
            "title": "Hours",
            "default": 72
          }
        },
        "type": "object",
        "title": "ShareRequest",
        "example": {
          "hours": 72
        }
      },
      "SharedDocumentResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "doc_type": {
            "$ref": "#/components/schemas/OutputDocumentType"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "share_expires_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Share Expires At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "doc_type",
          "created_at"
        ],
        "title": "SharedDocumentResponse"
      },
      "SharedOrderResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "order_no": {
            "type": "string",
            "title": "Order No"
          },
          "patient_name": {
            "type": "string",
            "title": "Patient Name"
          },
          "purpose": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Purpose"
          },
          "target_hospital": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Hospital"
          },
          "target_department": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Department"
          },
          "appointment_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Appointment Date"
          },
          "review_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review Notes"
          },
          "documents": {
            "items": {
              "$ref": "#/components/schemas/SharedDocumentResponse"
            },
            "type": "array",
            "title": "Documents"
          },
          "doctor_reviews": {
            "items": {
              "$ref": "#/components/schemas/DoctorReviewNoteResponse"
            },
            "type": "array",
            "title": "Doctor Reviews"
          },
          "doctor_review_requests": {
            "items": {
              "$ref": "#/components/schemas/DoctorReviewRequestResponse"
            },
            "type": "array",
            "title": "Doctor Review Requests"
          }
        },
        "type": "object",
        "required": [
          "id",
          "order_no",
          "patient_name"
        ],
        "title": "SharedOrderResponse"
      },
      "SharedPacketResponse": {
        "properties": {
          "order": {
            "$ref": "#/components/schemas/SharedOrderResponse"
          },
          "document_id": {
            "type": "string",
            "title": "Document Id"
          },
          "preview_path": {
            "type": "string",
            "title": "Preview Path"
          },
          "download_path": {
            "type": "string",
            "title": "Download Path"
          },
          "download_allowed": {
            "type": "boolean",
            "title": "Download Allowed",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "order",
          "document_id",
          "preview_path",
          "download_path"
        ],
        "title": "SharedPacketResponse"
      },
      "TokenResponse": {
        "properties": {
          "access_token": {
            "type": "string",
            "title": "Access Token"
          },
          "refresh_token": {
            "type": "string",
            "title": "Refresh Token"
          },
          "token_type": {
            "type": "string",
            "title": "Token Type",
            "default": "bearer"
          },
          "role": {
            "$ref": "#/components/schemas/UserRole"
          },
          "user_email": {
            "type": "string",
            "title": "User Email"
          },
          "mfa_verified": {
            "type": "boolean",
            "title": "Mfa Verified",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "access_token",
          "refresh_token",
          "role",
          "user_email"
        ],
        "title": "TokenResponse"
      },
      "TranslationFileResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "original_name": {
            "type": "string",
            "title": "Original Name"
          },
          "file_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "File Type"
          },
          "doc_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Doc Category"
          },
          "page_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Page Count"
          },
          "translated_text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Translated Text"
          },
          "processing_metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Processing Metadata"
          },
          "preview_path": {
            "type": "string",
            "title": "Preview Path"
          }
        },
        "type": "object",
        "required": [
          "id",
          "original_name",
          "preview_path"
        ],
        "title": "TranslationFileResponse"
      },
      "TranslationOrderResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "order_no": {
            "type": "string",
            "title": "Order No"
          },
          "patient_name": {
            "type": "string",
            "title": "Patient Name"
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "target_hospital": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Hospital"
          },
          "deadline_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deadline At"
          },
          "files": {
            "items": {
              "$ref": "#/components/schemas/TranslationFileResponse"
            },
            "type": "array",
            "title": "Files"
          }
        },
        "type": "object",
        "required": [
          "id",
          "order_no",
          "patient_name",
          "status"
        ],
        "title": "TranslationOrderResponse"
      },
      "UserResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "email": {
            "type": "string",
            "title": "Email"
          },
          "role": {
            "$ref": "#/components/schemas/UserRole"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "id",
          "email",
          "role"
        ],
        "title": "UserResponse"
      },
      "UserRole": {
        "type": "string",
        "enum": [
          "patient",
          "coordinator",
          "reviewer",
          "translator",
          "hospital_admin",
          "ops_admin",
          "super_admin"
        ],
        "title": "UserRole"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "tags": [
    {
      "name": "auth",
      "description": "Identity and session APIs for login and demo access."
    },
    {
      "name": "orders",
      "description": "Patient order intake, package generation, and order lifecycle operations."
    },
    {
      "name": "review",
      "description": "Reviewer triage queue, IPS validation, and approval/rejection actions."
    },
    {
      "name": "translation",
      "description": "Translator queue, source-document preview, and AI translation review actions."
    },
    {
      "name": "admin",
      "description": "Administrator-only operations, dashboards, and audit endpoints."
    },
    {
      "name": "hospital",
      "description": "Hospital-facing handoff actions, webhook dispatch, and FHIR bundle export."
    },
    {
      "name": "public",
      "description": "Public partner intake endpoints such as partner leads and compliance requests."
    },
    {
      "name": "ops",
      "description": "Operational health and environment check endpoints for deployment monitors."
    }
  ]
}