{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "schema for an Service Case question list",
    "items": {
        "$ref": "#/definitions/ServiceField"
    },
    "minItems": 1,
    "_uniqueItems": true,
    "type": "array",
    "definitions": {
        "ServiceField": {
            "type": "object",
            "oneOf": [
                {
                    "$ref": "#/definitions/ServiceNote"
                },
                {
                    "$ref": "#/definitions/ServiceQuestion"
                }
            ]
        },
        "ServiceFieldList": {
            "items": {
                "$ref": "#/definitions/ServiceField"
            },
            "minItems": 1,
            "_uniqueItems": true,
            "type": "array"
        },
        "ServiceNote": {
            "additionalProperties": false,
            "properties": {
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "label": {
                    "$ref": "#/definitions/label"
                },
                "hasAllowableModules": {
                    "$ref": "#/definitions/hasAllowableModules"
                },
                "hasBusinessCodes": {
                    "$ref": "#/definitions/hasBusinessCodes"
                },
                "hasDataType": {
                    "$ref": "#/definitions/hasDataType"
                },
                "hasLegacyCode": {
                    "$ref": "#/definitions/hasLegacyCode"
                },
                "hasOrderBy": {
                    "$ref": "#/definitions/hasOrderBy"
                },
                "hasChoiceValueList": {
                    "$ref": "#/definitions/hasChoiceValueList"
                },
                "hasDataSource": {
                    "$ref": "#/definitions/hasDataSource"
                },
                "isDisabled": {
                    "$ref": "#/definitions/isDisabled"
                },
                "type": {
                    "enum": [
                        "ServiceNote"
                    ]
                }
            },
            "required": [
                "iri",
                "label",
                "hasDataType",
                "hasOrderBy",
                "type"
            ],
            "type": "object"
        },
        "ServiceQuestion": {
            "additionalProperties": false,
            "properties": {
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "label": {
                    "$ref": "#/definitions/label"
                },
                "hasAllowableModules": {
                    "$ref": "#/definitions/hasAllowableModules"
                },
                "hasBusinessCodes": {
                    "$ref": "#/definitions/hasBusinessCodes"
                },
                "hasDataType": {
                    "$ref": "#/definitions/hasDataType"
                },
                "hasLegacyCode": {
                    "$ref": "#/definitions/hasLegacyCode"
                },
                "hasOrderBy": {
                    "$ref": "#/definitions/hasOrderBy"
                },
                "hasChoiceValueList": {
                    "$ref": "#/definitions/hasChoiceValueList"
                },
                "hasServiceFieldAlert": {
                    "$ref": "#/definitions/hasServiceFieldAlert"
                },
                "isDisabled": {
                    "$ref": "#/definitions/isDisabled"
                },
                "hasDefaultIntakeMethod": {
                    "$ref": "#/definitions/hasDefaultIntakeMethod"
                },
                "hasStandardizeStreetFormat": {
                    "$ref": "#/definitions/hasStandardizeStreetFormat"
                },
                "hasLegacyEvent": {
                    "$ref": "#/definitions/hasLegacyEvent"
                },
                "hasActivityAssignment": {
                    "$ref": "#/definitions/hasActivityAssignment"
                },
                "type": {
                    "enum": [
                        "ServiceQuestion"
                    ]
                }
            },
            "required": [
                "iri",
                "label",
                "hasDataType",
                "hasOrderBy",
                "type"
            ],
            "type": "object"
        },
        "hasStandardizeStreetFormat": {
            "enum": [
                "true",
                "false"
            ]
        },
        "isDisabled": {
            "enum": [
                "true",
                "false"
            ]
        },
        "booleanValue": {
            "enum": [
                "true",
                "false"
            ]
        },
        "hasBusinessCodes": {
            "pattern": "^,?(((NOUPDATE|REQINTAK|FQ_ALERT|SUCCESSR|WEBQREQD|5DAYWORK|INSSPEC|DUPSTAFF|REQRESAC|REQMASS),?)*)+$",
            "type": "string"
        },
        "hasOrderBy": {
            "pattern": "^[-+]?[0-9]*.?[0-9]+$",
            "type": "string"
        },
        "floatNumber": {
            "pattern": "^[-+]?[0-9]*.?[0-9]+$",
            "type": "string"
        },
        "label": {
            "type": "string"
        },
        "hasAllowableModules": {
            "pattern": "^,?(((SREINTAK|SRERESAC|SREMASS|SRSNGLWO|SRSUMMRY|WEBINTAK|SRSUMMRY|MD-WCS|MD-WCSL),?)*)+$",
            "type": "string"
        },
        "iri": {
            "type": "string"
        },
        "hasLegacyCode": {
            "type": "string"
        },
        "hasServiceFieldAlert": {
            "oneOf": [
                {
                    "$ref": "#/definitions/hasServiceFieldAlertList"
                },
                {
                    "$ref": "#/definitions/ServiceFieldAlert"
                }
            ]
        },
        "hasServiceFieldAlertList": {
            "items": {
                "type": "object",
                "oneOf": [
                    {
                        "$ref": "#/definitions/ServiceFieldAlert"
                    }
                ]
            },
            "minItems": 1,
            "type": "array"
        },
        "ServiceFieldAlert": {
            "properties": {
                "hasLegacyEvent": {
                    "$ref": "#/definitions/hasLegacyEvent"
                },
                "hasAnswerObject": {
                    "$ref": "#/definitions/hasAnswerObject"
                },
                "label": {
                    "$ref": "#/definitions/label"
                },
                "type": {
                    "enum": [
                        "QuestionTrigger"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                }
            },
            "required": [
                "iri",
                "label",
                "hasLegacyEvent",
                "type"
            ],
            "type": "object"
        },
        "hasDataType": {
            "enum": [
                "TIME",
                "CHAR",
                "DATE",
                "NUMBER",
                "CHARLIST",
                "CHARMULT",
                "CHAROPT",
                "PHONENUM"
            ]
        },
        "hasChoiceValueList": {
            "type": "object",
            "properties": {
                "hasChoiceValue": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/ChoiceValue"
                        },
                        {
                            "$ref": "#/definitions/ListOfChoiceValues"
                        }
                    ]
                },
                "label": {
                    "$ref": "#/definitions/label"
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "type": {
                    "enum": [
                        "ChoiceValueList"
                    ]
                }
            },
            "required": [
                "iri",
                "label",
                "hasChoiceValue",
                "type"
            ]
        },
        "hasChoiceValue": {
            "oneOf": [
                {
                    "$ref": "#/definitions/ChoiceValue"
                },
                {
                    "$ref": "#/definitions/ListOfChoiceValues"
                }
            ]
        },
        "ListOfChoiceValues": {
            "items": {
                "type": "object",
                "oneOf": [
                    {
                        "$ref": "#/definitions/ChoiceValue"
                    }
                ]
            },
            "minItems": 1,
            "type": "array"
        },
        "ChoiceValue": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "label": {
                    "$ref": "#/definitions/label"
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "hasLegacyCode": {
                    "$ref": "#/definitions/hasLegacyCode"
                },
                "hasOrderBy": {
                    "$ref": "#/definitions/hasOrderBy"
                },
                "isDisabled": {
                    "$ref": "#/definitions/isDisabled"
                },
                "hasLegacyEvent": {
                    "$ref": "#/definitions/hasLegacyEvent"
                },
                "type": {
                    "enum": [
                        "ChoiceValue"
                    ]
                }
            },
            "required": [
                "iri",
                "label",
                "type"
            ]
        },
        "ynQuestion": {
            "enum": [
                "Y",
                "N"
            ]
        },
        "hasDefaultIntakeMethod": {
            "type": "object",
            "properties": {
                "hasOrderBy": {
                    "$ref": "#/definitions/hasOrderBy"
                },
                "hasLegacyCode": {
                    "$ref": "#/definitions/hasLegacyCode"
                },
                "label": {
                    "$ref": "#/definitions/label"
                },
                "isAlwaysPublic": {
                    "$ref": "#/definitions/ynQuestion"
                },
                "type": {
                    "enum": [
                        "IntakeMethod"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                }
            },
            "required": [
                "iri",
                "label",
                "hasLegacyCode",
                "type"
            ]
        },
        "hasLegacyInterface": {
            "items": {
                "type": "object"
            },
            "minItems": 1,
            "type": "array"
        },
        "hasLegacyEvent": {
            "oneOf": [
                {
                    "$ref": "#/definitions/LegacyEventObject"
                },
                {
                    "$ref": "#/definitions/ListOfLegacyEventObject"
                }
            ]
        },
        "ListOfLegacyEventObject": {
            "items": {
                "type": "object",
                "oneOf": [
                    {
                        "$ref": "#/definitions/LegacyEventObject"
                    }
                ]
            },
            "minItems": 1,
            "type": "array"
        },
        "LegacyEventObject": {
            "type": "object",
            "properties": {
                "label": {
                    "$ref": "#/definitions/label"
                },
                "type": {
                    "enum": [
                        "ServiceFieldAlert",
                        "ClearServiceField",
                        "MarkServiceFieldRequired",
                        "MarkServiceFieldDisabled",
                        "ActivityAssignment",
                        "StatusChange"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "hasServiceField": {
                    "$ref": "#/definitions/ServiceFieldList"
                },
                "hasActivity": {
                    "$ref": "#/definitions/Activity"
                },
                "hasStatus": {
                    "$ref": "#/definitions/hasStatus"
                }
            }
        },
        "hasStatus": {
            "type": "object",
            "properties": {
                "label": {
                    "$ref": "#/definitions/label"
                },
                "type": {
                    "enum": [
                        "Status"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "hasLegacyCode": {
                    "$ref": "#/definitions/hasLegacyCode"
                },
                "hasOrderBy": {
                    "$ref": "#/definitions/hasOrderBy"
                },
                "hasAllowableStatuses": {
                    "$ref": "#/definitions/hasAllowableStatuses"
                },
                "isAlwaysPublic": {
                    "$ref": "#/definitions/ynQuestion"
                }
            }
        },
        "hasAllowableStatuses": {
            "pattern": "^,?(((C-CLOSED|O-OPEN|O-PENDING),?)*)+$",
            "type": "string"
        },
        "Activity": {
            "type": "object",
            "properties": {
                "label": {
                    "$ref": "#/definitions/label"
                },
                "type": {
                    "enum": [
                        "Activity"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "hasLegacyCode": {
                    "$ref": "#/definitions/hasLegacyCode"
                },
                "hasOrderBy": {
                    "$ref": "#/definitions/hasOrderBy"
                },
                "hasBusinessCodes": {
                    "$ref": "#/definitions/hasBusinessCodes"
                },
                "hasOccurDays": {
                    "$ref": "#/definitions/floatNumber"
                },
                "hasSuspenseDays": {
                    "$ref": "#/definitions/floatNumber"
                },
                "isAutoCreate": {
                    "$ref": "#/definitions/ynQuestion"
                },
                "isAutoAssign": {
                    "$ref": "#/definitions/booleanValue"
                },
                "hasAllowableOutcome": {
                    "$ref": "#/definitions/Outcome"
                },
                "hasDefaultOutcome": {
                    "$ref": "#/definitions/Outcome"
                },
                "hasAssignmentRule": {
                    "$ref": "#/definitions/hasAssignmentRule"
                },
                "hasActivityAssignment": {
                    "$ref": "#/definitions/hasActivityAssignment"
                }
            }
        },
        "hasAssignmentRule": {
            "type": "object",
            "properties": {
                "label": {
                    "$ref": "#/definitions/label"
                },
                "type": {
                    "enum": [
                        "AssignActivityToUserRule",
                        "CaseActivityAssignmentRule"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "hasUsername": {
                    "$ref": "#/definitions/username"
                }
            }
        },
        "Outcome": {
            "oneOf": [
                {
                    "$ref": "#/definitions/OutcomeObject"
                },
                {
                    "$ref": "#/definitions/ListOfOutcomeObject"
                }
            ]
        },
        "ListOfOutcomeObject": {
            "items": {
                "type": "object",
                "oneOf": [
                    {
                        "$ref": "#/definitions/OutcomeObject"
                    }
                ]
            },
            "minItems": 1,
            "type": "array"
        },
        "OutcomeObject": {
            "type": "object",
            "properties": {
                "label": {
                    "$ref": "#/definitions/label"
                },
                "hasLegacyCode": {
                    "$ref": "#/definitions/hasLegacyCode"
                },
                "hasLegacyEvent": {
                    "$ref": "#/definitions/hasLegacyEvent"
                },
                "type": {
                    "enum": [
                        "Outcome"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                }
            }
        },
        "hasActivityAssignment": {
            "oneOf": [
                {
                    "$ref": "#/definitions/ActivityAssignmentObject"
                },
                {
                    "$ref": "#/definitions/ListOfActivityAssignmentObject"
                }
            ]
        },
        "ListOfActivityAssignmentObject": {
            "items": {
                "type": "object",
                "oneOf": [
                    {
                        "$ref": "#/definitions/ActivityAssignmentObject"
                    }
                ]
            },
            "minItems": 1,
            "type": "array"
        },
        "ActivityAssignmentObject": {
            "type": "object",
            "properties": {
                "label": {
                    "$ref": "#/definitions/label"
                },
                "hasActivity": {
                    "$ref": "#/definitions/Activity"
                },
                "hasOutcome": {
                    "$ref": "#/definitions/Outcome"
                },
                "hasLegacyEvent": {
                    "$ref": "#/definitions/hasLegacyEvent"
                },
                "hasAnswerObject": {
                    "$ref": "#/definitions/hasAnswerObject"
                },
                "type": {
                    "enum": [
                        "Activity Trigger",
                        "QuestionTrigger"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                }
            }
        },
        "username": {
            "type": "string"
        },
        "hasAnswerObject": {
            "type": "object",
            "properties": {
                "hasLegacyCode": {
                    "$ref": "#/definitions/hasLegacyCode"
                },
                "label": {
                    "$ref": "#/definitions/label"
                },
                "type": {
                    "enum": [
                        "ChoiceValue"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "hasLegacyEvent": {
                    "$ref": "#/definitions/hasLegacyEvent"
                }
            },
            "required": [
                "iri",
                "label",
                "hasLegacyCode",
                "type"
            ]
        },
        "hasDataSource": {
            "type": "object",
            "properties": {
                "providedBy": {
                    "$ref": "#/definitions/providedBy"
                },
                "label": {
                    "$ref": "#/definitions/label"
                },
                "type": {
                    "enum": [
                        "EventBasedDataSource"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                },
                "hasPropertyName": {
                    "$ref": "#/definitions/label"
                }
            },
            "required": [
                "iri",
                "label",
                "providedBy",
                "hasPropertyName",
                "type"
            ]
        },
        "providedBy": {
            "type": "object",
            "properties": {
                "label": {
                    "$ref": "#/definitions/label"
                },
                "type": {
                    "enum": [
                        "ClientSideEventType"
                    ]
                },
                "iri": {
                    "$ref": "#/definitions/iri"
                }
            },
            "required": [
                "iri",
                "label",
                "type"
            ]
        }
    }
}