{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "user": {
      "type": "object",
      "properties": {
        "userID": {
          "type": "integer"
        },
        "userSecretKey": {
          "type": [
            "string",
            "null"
          ]
        },
        "userUsername": {
          "type": [
            "string",
            "null"
          ]
        },
        "userPassword": {
          "type": [
            "string",
            "null"
          ]
        },
        "userFullName": {
          "type": [
            "string",
            "null"
          ]
        },
        "userEmail": {
          "type": [
            "string",
            "null"
          ]
        },
        "userPhone": {
          "type": [
            "string",
            "null"
          ]
        },
        "userStatus": {
          "type": [
            "string",
            "null"
          ]
        },
        "userCreatedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "userModifiedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "caseInstance": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/caseInstance"
          }
        },
        "caseTimeline": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/caseTimeline"
          }
        },
        "forms": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/form"
          }
        },
        "formHistoryEntries": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/formHistory"
          }
        },
        "processes": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/process"
          }
        },
        "processHistoryEntries": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/processHistory"
          }
        },
        "task": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/task"
          }
        },
        "userrole": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/userrole"
          }
        },
        "startedCases": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/caseInstance"
          }
        },
        "assignedTasks": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/task"
          }
        },
        "caseTimelineEntries": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/caseTimeline"
          }
        }
      }
    },
    "role": {
      "type": "object",
      "properties": {
        "roleID": {
          "type": "integer"
        },
        "roleName": {
          "type": [
            "string",
            "null"
          ]
        },
        "roleDescription": {
          "type": [
            "string",
            "null"
          ]
        },
        "roleStatus": {
          "type": [
            "string",
            "null"
          ]
        },
        "roleCreatedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "roleModifiedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "userrole": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/userrole"
          }
        }
      }
    },
    "userrole": {
      "type": "object",
      "properties": {
        "userRoleID": {
          "type": "integer"
        },
        "userRoleCreatedDate": {
          "type": "string",
          "format": "date-time"
        },
        "role": {
          "$ref": "#/definitions/role"
        },
        "user": {
          "$ref": "#/definitions/user"
        }
      }
    },
    "form": {
      "type": "object",
      "properties": {
        "formID": {
          "type": "integer"
        },
        "formUUID": {
          "type": "string"
        },
        "formName": {
          "type": "string"
        },
        "formDescription": {
          "type": [
            "string",
            "null"
          ]
        },
        "formComponents": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "formStatus": {
          "type": "string",
          "default": "active"
        },
        "formCreatedDate": {
          "type": "string",
          "format": "date-time"
        },
        "formModifiedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "customCSS": {
          "type": [
            "string",
            "null"
          ]
        },
        "customScript": {
          "type": [
            "string",
            "null"
          ]
        },
        "formEvents": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "scriptMode": {
          "type": [
            "string",
            "null"
          ],
          "default": "safe"
        },
        "creator": {
          "anyOf": [
            {
              "$ref": "#/definitions/user"
            },
            {
              "type": "null"
            }
          ]
        },
        "history": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/formHistory"
          }
        },
        "tasks": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/task"
          }
        }
      }
    },
    "formHistory": {
      "type": "object",
      "properties": {
        "historyID": {
          "type": "integer"
        },
        "formUUID": {
          "type": "string"
        },
        "formName": {
          "type": "string"
        },
        "formDescription": {
          "type": [
            "string",
            "null"
          ]
        },
        "formComponents": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "formStatus": {
          "type": "string"
        },
        "customCSS": {
          "type": [
            "string",
            "null"
          ]
        },
        "customScript": {
          "type": [
            "string",
            "null"
          ]
        },
        "formEvents": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "scriptMode": {
          "type": [
            "string",
            "null"
          ]
        },
        "versionNumber": {
          "type": "integer"
        },
        "changeDescription": {
          "type": [
            "string",
            "null"
          ]
        },
        "savedDate": {
          "type": "string",
          "format": "date-time"
        },
        "form": {
          "$ref": "#/definitions/form"
        },
        "savedByUser": {
          "anyOf": [
            {
              "$ref": "#/definitions/user"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "process": {
      "type": "object",
      "properties": {
        "processID": {
          "type": "integer"
        },
        "processUUID": {
          "type": "string"
        },
        "processName": {
          "type": "string"
        },
        "processDescription": {
          "type": [
            "string",
            "null"
          ]
        },
        "processDefinition": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "processVersion": {
          "type": "integer",
          "default": 1
        },
        "processStatus": {
          "type": "string",
          "default": "draft"
        },
        "processCreatedDate": {
          "type": "string",
          "format": "date-time"
        },
        "processModifiedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "isTemplate": {
          "type": "boolean",
          "default": false
        },
        "processCategory": {
          "type": [
            "string",
            "null"
          ]
        },
        "processOwner": {
          "type": [
            "string",
            "null"
          ]
        },
        "processPermissions": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "processPriority": {
          "type": [
            "string",
            "null"
          ],
          "default": "normal"
        },
        "processSettings": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "processVariables": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "templateCategory": {
          "type": [
            "string",
            "null"
          ]
        },
        "processDeletedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "caseInstance": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/caseInstance"
          }
        },
        "creator": {
          "anyOf": [
            {
              "$ref": "#/definitions/user"
            },
            {
              "type": "null"
            }
          ]
        },
        "history": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/processHistory"
          }
        },
        "cases": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/caseInstance"
          }
        }
      }
    },
    "processHistory": {
      "type": "object",
      "properties": {
        "historyID": {
          "type": "integer"
        },
        "processUUID": {
          "type": "string"
        },
        "processName": {
          "type": "string"
        },
        "processDescription": {
          "type": [
            "string",
            "null"
          ]
        },
        "processDefinition": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "processVersion": {
          "type": "integer"
        },
        "processStatus": {
          "type": "string"
        },
        "processCategory": {
          "type": [
            "string",
            "null"
          ]
        },
        "processOwner": {
          "type": [
            "string",
            "null"
          ]
        },
        "processPermissions": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "processPriority": {
          "type": [
            "string",
            "null"
          ]
        },
        "processSettings": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "processVariables": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "templateCategory": {
          "type": [
            "string",
            "null"
          ]
        },
        "versionNumber": {
          "type": "integer"
        },
        "changeDescription": {
          "type": [
            "string",
            "null"
          ]
        },
        "savedDate": {
          "type": "string",
          "format": "date-time"
        },
        "process": {
          "$ref": "#/definitions/process"
        },
        "savedByUser": {
          "anyOf": [
            {
              "$ref": "#/definitions/user"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "caseInstance": {
      "type": "object",
      "properties": {
        "caseID": {
          "type": "integer"
        },
        "caseUUID": {
          "type": "string"
        },
        "caseName": {
          "type": "string"
        },
        "caseStatus": {
          "type": "string",
          "default": "active"
        },
        "caseVariables": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "caseSettings": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "caseDefinition": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "caseCreatedDate": {
          "type": "string",
          "format": "date-time"
        },
        "caseModifiedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "caseCompletedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "process": {
          "$ref": "#/definitions/process"
        },
        "startedBy": {
          "anyOf": [
            {
              "$ref": "#/definitions/user"
            },
            {
              "type": "null"
            }
          ]
        },
        "tasks": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/task"
          }
        },
        "timeline": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/caseTimeline"
          }
        }
      }
    },
    "task": {
      "type": "object",
      "properties": {
        "taskID": {
          "type": "integer"
        },
        "taskUUID": {
          "type": "string"
        },
        "taskName": {
          "type": "string"
        },
        "taskType": {
          "type": "string"
        },
        "taskStatus": {
          "type": "string",
          "default": "pending"
        },
        "taskData": {
          "type": [
            "number",
            "string",
            "boolean",
            "object",
            "array",
            "null"
          ]
        },
        "taskCreatedDate": {
          "type": "string",
          "format": "date-time"
        },
        "taskModifiedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "taskCompletedDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "case": {
          "$ref": "#/definitions/caseInstance"
        },
        "assignedTo": {
          "anyOf": [
            {
              "$ref": "#/definitions/user"
            },
            {
              "type": "null"
            }
          ]
        },
        "form": {
          "anyOf": [
            {
              "$ref": "#/definitions/form"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "caseTimeline": {
      "type": "object",
      "properties": {
        "timelineID": {
          "type": "integer"
        },
        "timelineType": {
          "type": "string"
        },
        "timelineDescription": {
          "type": [
            "string",
            "null"
          ]
        },
        "timelineDate": {
          "type": "string",
          "format": "date-time"
        },
        "case": {
          "$ref": "#/definitions/caseInstance"
        },
        "createdBy": {
          "anyOf": [
            {
              "$ref": "#/definitions/user"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  },
  "type": "object",
  "properties": {
    "user": {
      "$ref": "#/definitions/user"
    },
    "role": {
      "$ref": "#/definitions/role"
    },
    "userrole": {
      "$ref": "#/definitions/userrole"
    },
    "form": {
      "$ref": "#/definitions/form"
    },
    "formHistory": {
      "$ref": "#/definitions/formHistory"
    },
    "process": {
      "$ref": "#/definitions/process"
    },
    "processHistory": {
      "$ref": "#/definitions/processHistory"
    },
    "caseInstance": {
      "$ref": "#/definitions/caseInstance"
    },
    "task": {
      "$ref": "#/definitions/task"
    },
    "caseTimeline": {
      "$ref": "#/definitions/caseTimeline"
    }
  }
}