{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/optum/json-schema/optum-order-sign-request-schema.json",
  "title": "OrderSignRequest",
  "description": "CDS Hooks Order Sign Request payload",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/optum-ordersign-api-openapi.yml#/components/schemas/OrderSignRequest",
  "type": "object",
  "properties": {
    "hook": {
      "type": "string",
      "description": "CDS Hooks hook name"
    },
    "hookInstance": {
      "type": "string",
      "description": "Unique hook instance identifier"
    },
    "fhirServer": {
      "type": "string",
      "description": "FHIR server base URL"
    },
    "fhirAuthorization": {
      "$ref": "#/$defs/FhirAuthorization"
    },
    "context": {
      "$ref": "#/$defs/Context"
    },
    "prefetch": {
      "$ref": "#/$defs/Prefetch"
    }
  },
  "$defs": {
    "Bundle": {
      "type": "object",
      "description": "FHIR Bundle resource",
      "properties": {
        "resourceType": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "entry": {
          "type": "array",
          "description": "Bundle entries",
          "items": {
            "$ref": "#/$defs/Entry"
          }
        }
      }
    },
    "CareTeam": {
      "type": "object",
      "properties": {
        "provider": {
          "$ref": "#/$defs/Reference"
        },
        "responsible": {
          "type": "boolean"
        }
      }
    },
    "Claim": {
      "type": "object",
      "description": "FHIR Claim Inquiry Request",
      "properties": {
        "resourceType": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "meta": {
          "$ref": "#/$defs/Meta"
        },
        "identifier": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Identifier"
          }
        },
        "status": {
          "type": "string"
        },
        "type": {
          "$ref": "#/$defs/CodeableConcept"
        },
        "use": {
          "type": "string"
        },
        "created": {
          "type": "string"
        },
        "patient": {
          "$ref": "#/$defs/Reference"
        },
        "provider": {
          "$ref": "#/$defs/Reference"
        },
        "careTeam": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CareTeam"
          }
        }
      }
    },
    "CodeableConcept": {
      "type": "object",
      "description": "FHIR CodeableConcept",
      "properties": {
        "coding": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Coding"
          }
        }
      }
    },
    "Coding": {
      "type": "object",
      "description": "Coding structure for answers",
      "properties": {
        "code": {
          "type": "string"
        },
        "display": {
          "type": "string"
        }
      }
    },
    "Context": {
      "type": "object",
      "description": "CDS Hooks context information",
      "properties": {
        "userId": {
          "type": "string",
          "description": "User identifier"
        },
        "patientId": {
          "type": "string",
          "description": "Patient identifier"
        },
        "encounterId": {
          "type": "string",
          "description": "Encounter identifier"
        },
        "draftOrders": {
          "$ref": "#/$defs/Bundle"
        }
      }
    },
    "Entry": {
      "type": "object",
      "properties": {
        "resource": {
          "$ref": "#/$defs/Claim"
        }
      }
    },
    "FhirAuthorization": {
      "type": "object",
      "description": "FHIR authorization details",
      "properties": {
        "access_token": {
          "type": "string",
          "description": "Access token for FHIR server"
        },
        "token_type": {
          "type": "string",
          "description": "Token type"
        },
        "expires_in": {
          "type": "integer",
          "description": "Token expiration time in seconds"
        },
        "scope": {
          "type": "string",
          "description": "Authorized scope"
        },
        "subject": {
          "type": "string",
          "description": "Subject identifier"
        }
      }
    },
    "Identifier": {
      "type": "object",
      "properties": {
        "system": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "Meta": {
      "type": "object",
      "description": "FHIR metadata",
      "properties": {
        "profile": {
          "type": "array",
          "description": "FHIR profile URLs",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "Prefetch": {
      "type": "object",
      "properties": {
        "claimResponse": {
          "type": "string"
        },
        "condition": {
          "type": "string"
        },
        "coverage": {
          "type": "string"
        },
        "device": {
          "type": "string"
        },
        "encounter": {
          "type": "string"
        },
        "location": {
          "type": "string"
        },
        "patient": {
          "type": "string"
        },
        "practitioner": {
          "type": "string"
        },
        "practitionerRole": {
          "type": "string"
        }
      }
    },
    "Reference": {
      "type": "object",
      "description": "FHIR Reference",
      "properties": {
        "reference": {
          "type": "string"
        }
      }
    }
  }
}