{
  "$schema": "https://abhcr.github.io/comcom-protocol/releases/v0.2.0/schemas/comcom-meta.schema.json",
  "$id": "https://abhcr.github.io/comcom-protocol/releases/v0.2.0/profiles/v0.2/regulated.social/comcom-healthcare-service-request/schemas/resource.schema.json",
  "title": "HealthcareService resource for comcom.healthcare.service.request",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "type",
    "state",
    "revision",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Globally unique resource URI.",
      "format": "uri-reference"
    },
    "type": {
      "const": "HealthcareService"
    },
    "state": {
      "enum": [
        "submitted",
        "accepted",
        "rejected"
      ]
    },
    "revision": {
      "type": "integer",
      "minimum": 0
    },
    "createdAt": {
      "type": "string",
      "description": "Creation instant.",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "description": "Last update instant.",
      "format": "date-time"
    },
    "statusCode": {
      "type": "string",
      "description": "Profile-defined business state.",
      "pattern": "^[a-z][a-zA-Z0-9.-]{0,63}$"
    },
    "patientId": {
      "type": "string",
      "description": "Patient URI.",
      "format": "uri-reference"
    },
    "providerId": {
      "type": "string",
      "description": "Healthcare provider URI.",
      "format": "uri-reference"
    },
    "serviceCode": {
      "type": "string",
      "description": "Clinical service code.",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
    },
    "referralId": {
      "type": "string",
      "description": "Referral URI.",
      "format": "uri-reference"
    },
    "prescriptionId": {
      "type": "string",
      "description": "Prescription URI.",
      "format": "uri-reference"
    },
    "scheduledAt": {
      "type": "string",
      "description": "Scheduled instant.",
      "format": "date-time"
    },
    "purposeCode": {
      "type": "string",
      "description": "Authorized purpose code.",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
    }
  }
}
