{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ellkay/json-schema/ellkay-lkcloud-connect-swagger-swagger-requests-update-patient-create-referral-swagger-request-schema.json",
  "title": "LKCloudConnect.Swagger.SwaggerRequests.UpdatePatient.CreateReferralSwaggerRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ellkay-updatepatient-api-openapi.yml#/components/schemas/LKCloudConnect.Swagger.SwaggerRequests.UpdatePatient.CreateReferralSwaggerRequest",
  "type": "object",
  "properties": {
    "request": {
      "allOf": [
        {
          "$ref": "#/$defs/LKCloudConnect.Contracts.UpdatePatient.CreateReferralRequest"
        }
      ]
    }
  },
  "additionalProperties": false,
  "$defs": {
    "LKCloudConnect.Contracts.Bridge.ReferralReason": {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string",
          "description": "Medical justification or reason for the referral or authorization"
        }
      },
      "additionalProperties": false
    },
    "LKCloudConnect.Contracts.Bridge.ReferralsDiagnosis": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "Description of the diagnosis"
        },
        "code": {
          "type": "string",
          "description": "Diagnosis code"
        },
        "system": {
          "type": "string",
          "description": "Coding system for the diagnosis"
        },
        "isPrimary": {
          "type": "boolean",
          "description": "Indicates if this is the primary diagnosis"
        }
      },
      "additionalProperties": false
    },
    "LKCloudConnect.Contracts.Bridge.ReferralsProcedure": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "Name or description of the procedure"
        },
        "code": {
          "type": "string",
          "description": "Procedure code"
        },
        "system": {
          "type": "string",
          "description": "Coding system for procedure"
        }
      },
      "additionalProperties": false
    },
    "LKCloudConnect.Contracts.UpdatePatient.CreateReferralRequest": {
      "required": [
        "patientId"
      ],
      "type": "object",
      "properties": {
        "patientId": {
          "minLength": 1,
          "type": "string",
          "description": "PatientId id"
        },
        "authorizationNumber": {
          "type": "string",
          "description": "Authorization number assigned by payer or internal system"
        },
        "referralId": {
          "type": "string",
          "description": "Linked referral ID, if applicable"
        },
        "referralNumber": {
          "type": "string",
          "description": "External or human-readable referral number"
        },
        "status": {
          "type": "string",
          "description": "Current status of the referral (e.g., pending, approved, denied)"
        },
        "priority": {
          "enum": [
            "Unknown",
            "routine",
            "urgent",
            "stat"
          ],
          "type": "string",
          "description": "Indicates urgency level of the request"
        },
        "referralType": {
          "type": "string",
          "description": "Specifies the classification or subtype of the referral authorization.\nExamples include \"Incoming\" or \"Outgoing\"."
        },
        "reasons": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LKCloudConnect.Contracts.Bridge.ReferralReason"
          },
          "description": "Medical justification or reason for the referral or authorization"
        },
        "insCode": {
          "type": "string",
          "description": "Insurance or payer code"
        },
        "encounterId": {
          "type": "string",
          "description": "Identifier of the related clinical encounter"
        },
        "fromFacilityId": {
          "type": "string",
          "description": "ID of the referring facility"
        },
        "fromPhysicianId": {
          "type": "string",
          "description": "ID of the referring physician"
        },
        "toFacilityId": {
          "type": "string",
          "description": "ID of the facility where the service will be performed"
        },
        "toPhysicianId": {
          "type": "string",
          "description": "ID of the physician who will perform the procedure"
        },
        "specialty": {
          "type": "string",
          "description": "Indicates the medical specialty or area of care related to the referral.\nExamples include Cardiology, Dental Care, Orthopedics, etc."
        },
        "appointmentDate": {
          "type": "string",
          "description": "Scheduled date of the appointment or service. (DateTimeOffset) e.g. 2019-01-01T00:00:00.000+00:00",
          "format": "date-time"
        },
        "referralDate": {
          "type": "string",
          "description": "Date when the referral or authorization was created. (DateTimeOffset) e.g. 2019-01-01T00:00:00.000+00:00",
          "format": "date-time"
        },
        "effectiveDate": {
          "type": "string",
          "description": "Start date of the authorization coverage period. (DateTimeOffset) e.g. 2019-01-01T00:00:00.000+00:00",
          "format": "date-time"
        },
        "expirationDate": {
          "type": "string",
          "description": "End date of the authorization coverage period. (DateTimeOffset) e.g. 2019-01-01T00:00:00.000+00:00",
          "format": "date-time"
        },
        "dateRecorded": {
          "type": "string",
          "description": "Timestamp when this record was entered into the system. (DateTimeOffset) e.g. 2019-01-01T00:00:00.000+00:00",
          "format": "date-time"
        },
        "diagnosis": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LKCloudConnect.Contracts.Bridge.ReferralsDiagnosis"
          },
          "description": "List of diagnosis entries associated with this authorization"
        },
        "procedure": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LKCloudConnect.Contracts.Bridge.ReferralsProcedure"
          },
          "description": "List of procedures or services authorized"
        },
        "notes": {
          "type": "string",
          "description": "Additional notes or comments related to the referral or authorization"
        },
        "custom": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": "System-specific data for special cases"
        }
      },
      "additionalProperties": false
    }
  }
}