{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "https://sv.telesv.com/schemas/CreateExternalCustomData_v1.001.json",
  "type": "object",
  "title": "CreateExternalCustomData",
  "description": "This command is used to send custom data values",
  "required": [
    "header",
    "body"
  ],
  "properties": {
    "header": {
      "title": "CreateExternalCustomDataHeader",
      "$schema": "http://json-schema.org/draft-07/schema",
      "$id": "#business-command-initialization-header-v3.001",
      "type": "object",
      "description": "Header metadata that helps describe an initial command issued from a service",
      "required": [
        "schemaUri",
        "version",
        "sourceId",
        "id",
        "correlationId",
        "tenantId",
        "ttl",
        "command",
        "dateTime",
        "userId"
      ],
      "properties": {
        "schemaUri": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "version": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "sourceId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#guid-required_v1.002",
          "title": "guid-required",
          "description": "A guid that does not allow for an empty guid and only lower case guids",
          "type": "string",
          "pattern": "^0(?!0{7}-0{4}-0{4}-0{4}-0{12})[0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[1-9a-f][0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "id": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#guid-required_v1.002",
          "title": "guid-required",
          "description": "A guid that does not allow for an empty guid and only lower case guids",
          "type": "string",
          "pattern": "^0(?!0{7}-0{4}-0{4}-0{4}-0{12})[0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[1-9a-f][0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "correlationId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#guid-required_v1.002",
          "title": "guid-required",
          "description": "A guid that does not allow for an empty guid and only lower case guids",
          "type": "string",
          "pattern": "^0(?!0{7}-0{4}-0{4}-0{4}-0{12})[0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[1-9a-f][0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "tenantId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#guid-required_v1.002",
          "title": "guid-required",
          "description": "A guid that does not allow for an empty guid and only lower case guids",
          "type": "string",
          "pattern": "^0(?!0{7}-0{4}-0{4}-0{4}-0{12})[0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[1-9a-f][0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "ttl": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#time-to-live-v1.001",
          "title": "Time To Live",
          "description": "Defines the data type are restrictions for a time-to-live value",
          "type": "integer",
          "minimum": 0
        },
        "command": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1,
          "const": "CreateExternalCustomData"
        },
        "dateTime": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#datetime_v1.001",
          "title": "datetime",
          "description": "A date time type based on the ISO8601 format",
          "type": "string",
          "format": "date-time"
        },
        "userId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#guid-required_v1.002",
          "title": "guid-required",
          "description": "A guid that does not allow for an empty guid and only lower case guids",
          "type": "string",
          "pattern": "^0(?!0{7}-0{4}-0{4}-0{4}-0{12})[0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[1-9a-f][0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "occurrenceDateTime": {
          "$id": "#occurrenceDateTime",
          "title": "OccurrenceDateTime",
          "description": "The time the event occurred in the real world",
          "$schema": "http://json-schema.org/draft-07/schema",
          "type": "string",
          "format": "date-time"
        },
        "tags": {
          "type": "array",
          "items": {
            "$schema": "http://json-schema.org/draft-07/schema",
            "$id": "#string-required_v1.001",
            "title": "string-required",
            "description": "A string type that does not allow for an empty string",
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "body": {
      "title": "CreateExternalCustomDataBody",
      "$schema": "http://json-schema.org/draft-07/schema",
      "$id": "#external-custom-data-v1.001",
      "type": "object",
      "required": [
        "externalSource",
        "externalDataId",
        "externalDataValue"
      ],
      "properties": {
        "id": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#guid-required_v1.002",
          "title": "guid-required",
          "description": "A guid that does not allow for an empty guid and only lower case guids",
          "type": "string",
          "pattern": "^0(?!0{7}-0{4}-0{4}-0{4}-0{12})[0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[1-9a-f][0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "externalSource": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "facilityExternalId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "visitExternalId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "locationExternalId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "patientExternalId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "externalDataCategory": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "externalDataId": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        },
        "externalDataValue": {
          "$schema": "http://json-schema.org/draft-07/schema",
          "$id": "#string-required_v1.001",
          "title": "string-required",
          "description": "A string type that does not allow for an empty string",
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}