{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "$ref": "#/components/schemas/PkgWorkflowVM",
  "components": {
    "schemas": {
      "PkgWorkflowVM": {
        "required": [
          "initStateKey",
          "key",
          "name"
        ],
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "nullable": true
          },
          "diagramContent": {
            "type": "string",
            "nullable": true
          },
          "diagramContentType": {
            "maxLength": 100,
            "type": "string",
            "nullable": true
          },
          "initStateKey": {
            "minLength": 1,
            "type": "string"
          },
          "isDefault": {
            "type": "boolean",
            "nullable": true
          },
          "isEmpty": {
            "type": "boolean",
            "nullable": true
          },
          "isSelectable": {
            "type": "boolean",
            "nullable": true
          },
          "key": {
            "minLength": 1,
            "type": "string"
          },
          "name": {
            "minLength": 1,
            "type": "string"
          },
          "state": {
            "enum": [
              "active",
              "inactive",
              "in-validation",
              "hidden"
            ],
            "type": "string",
            "nullable": true
          },
          "transitions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PkgWorkflowStateTransitionVM"
            },
            "nullable": true
          },
          "translations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PkgEntityTranslationVM"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PkgEntityTranslationVM": {
        "required": [
          "languageKey"
        ],
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "nullable": true
          },
          "languageKey": {
            "minLength": 1,
            "type": "string"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "shortcut": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PkgWorkflowStateTransitionVM": {
        "required": [
          "fromStateKey",
          "toStateKey"
        ],
        "type": "object",
        "properties": {
          "changeThresholdTypeKey": {
            "enum": [
              "one_user",
              "all_users_one_from_groups",
              "all_users_all_from_groups"
            ],
            "type": "string",
            "nullable": true
          },
          "fromStateKey": {
            "minLength": 1,
            "type": "string"
          },
          "isForceComment": {
            "type": "boolean",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "notifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PkgWorkflowNotificationVM"
            },
            "nullable": true
          },
          "toStateKey": {
            "minLength": 1,
            "type": "string"
          },
          "translations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PkgEntityTranslationVM"
            },
            "nullable": true
          },
          "triggers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PkgWorkflowTransitionTriggerVM"
            },
            "nullable": true
          },
          "userRelationTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PkgWorkflowUserRelationTypeVM"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PkgWorkflowUserRelationTypeVM": {
        "required": [
          "key"
        ],
        "type": "object",
        "properties": {
          "isHidden": {
            "type": "boolean",
            "nullable": true
          },
          "key": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "PkgWorkflowTransitionTriggerVM": {
        "required": [
          "changeUserRelationTypeKey"
        ],
        "type": "object",
        "properties": {
          "changeToValueUserRelationTypeKey": {
            "type": "string",
            "nullable": true
          },
          "changeUserRelationTypeKey": {
            "minLength": 1,
            "type": "string"
          },
          "orderNumber": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "pipelineKey": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "enum": [
              "default",
              "to_current_user",
              "select_user_from_allowed"
            ],
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PkgWorkflowNotificationVM": {
        "required": [
          "notificationTemplateKey",
          "recipientUserRelationTypeKey"
        ],
        "type": "object",
        "properties": {
          "applicationKey": {
            "type": "string",
            "nullable": true
          },
          "notificationTemplateKey": {
            "minLength": 1,
            "type": "string"
          },
          "objectTypeKey": {
            "type": "string",
            "nullable": true
          },
          "recipientUserRelationTypeKey": {
            "minLength": 1,
            "type": "string"
          },
          "spacePath": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    }
  }
}