{
    "title": "workflow",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "javaType": "com.sos.sign.model.workflow.Workflow",
    "type": "object",
    "javaInterfaces": [
        "com.sos.joc.model.common.IDeployObject"
    ],
    "required": [
        "TYPE",
        "path",
        "versionId",
        "instructions"
    ],
    "propertyOrder": [
        "TYPE",
        "path",
        "versionId",
        "timeZone",
        "orderPreparation",
        "jobResourcePaths",
        "instructions",
        "jobs"
    ],
    "description": "deploy object with fixed property 'TYPE':'Workflow'",
    "properties": {
        "TYPE": {
            "javaType": "com.sos.inventory.model.deploy.DeployType",
            "type": "string",
            "enum": [
                "Workflow",
                "JobClass",
                "Lock",
                "FileWatch",
                "JobResource",
                "Board"
            ],
            "javaEnumNames": [
                "Workflow",
                "JobClass",
                "Lock",
                "FileWatch",
                "JobResource",
                "Board"
            ],
            "default": "Workflow"
        },
        "path": {
            "type": "string",
            "pattern": "^[^<>]*$",
            "maxLength": 255
        },
        "versionId": {
            "type": "string",
            "pattern": "^[^<>]*$",
            "maxLength": 255
        },
        "timeZone": {
            "type": "string",
            "default": "Etc/UTC"
        },
        "calendarPath": {
            "type": "string",
            "pattern": "^[^<>]*$",
            "maxLength": 255
        },
        "orderPreparation": {
            "javaType": "com.sos.sign.model.workflow.OrderPreparation",
            "type": "object",
            "alias": "orderRequirements",
            "properties": {
                "parameters": {
                    "javaType": "com.sos.sign.model.workflow.Parameters",
                    "type": "object",
                    "additionalProperties": {
                        "javaType": "com.sos.sign.model.workflow.Parameter",
                        "type": "object",
                        "required": [
                            "type"
                        ],
                        "description": "parameters only for parameter type 'List'",
                        "properties": {
                            "type": {
                                "anyOf": [
                                    {
                                        "javaType": "com.sos.inventory.model.workflow.ListParameterType",
                                        "type": "string",
                                        "enum": [
                                            "String",
                                            "Number",
                                            "Boolean"
                                        ],
                                        "javaEnumNames": [
                                            "String",
                                            "Number",
                                            "Boolean"
                                        ]
                                    },
                                    {
                                        "javaType": "com.sos.sign.model.workflow.ParameterListType",
                                        "type": "object",
                                        "required": [
                                            "TYPE",
                                            "elementType"
                                        ],
                                        "properties": {
                                            "TYPE": {
                                                "type": "string",
                                                "default": "List"
                                            },
                                            "elementType": {
                                                "type": "object",
                                                "javaType": "com.sos.sign.model.workflow.ListParameters",
                                                "properties": {
                                                    "TYPE": {
                                                        "type": "string",
                                                        "default": "Object"
                                                    }
                                                },
                                                "additionalProperties": {
                                                    "javaType": "com.sos.inventory.model.workflow.ListParameterType",
                                                    "type": "string",
                                                    "enum": [
                                                        "String",
                                                        "Number",
                                                        "Boolean"
                                                    ],
                                                    "javaEnumNames": [
                                                        "String",
                                                        "Number",
                                                        "Boolean"
                                                    ]
                                                }
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                ]
                            },
                            "default": {
                                "description": "this value has to have the data type of the 'type' attribute",
                                "javaType": "java.lang.Object"
                            },
                            "final": {
                                "type": "string"
                            }
                        },
                        "additionalProperties": false
                    }
                },
                "allowUndeclared": {
                    "type": "boolean"
                }
            },
            "additionalProperties": false
        },
        "jobResourcePaths": {
            "alias": "jobResourceNames",
            "type": "array",
            "items": {
                "type": "string",
                "pattern": "^[^<>]*$",
                "maxLength": 255
            }
        },
        "instructions": {
            "type": "array",
            "minItems": 1,
            "items": {
                "javaType": "com.sos.sign.model.instruction.Instruction",
                "type": "object",
                "required": [
                    "TYPE"
                ],
                "properties": {
                    "TYPE": {
                        "javaType": "com.sos.inventory.model.instruction.InstructionType",
                        "type": "string",
                        "enum": [
                            "Execute.Named",
                            "If",
                            "Try",
                            "Fork",
                            "ForkList",
                            "Finish",
                            "Fail",
                            "Retry",
                            "Lock",
                            "Prompt",
                            "PostNotice",
                            "PostNotices",
                            "ExpectNotice",
                            "ExpectNotices",
                            "ConsumeNotices",
                            "ImplicitEnd",
                            "AddOrder",
                            "Cycle"
                        ]
                    }
                },
                "additionalProperties": false
            }
        },
        "jobs": {
            "javaType": "com.sos.sign.model.workflow.Jobs",
            "type": "object",
            "additionalProperties": {
                "javaType": "com.sos.sign.model.job.Job",
                "type": "object",
                "required": [
                    "agentPath",
                    "executable"
                ],
                "description": "returnCodeMeaning is deprecated: moved to ShellScriptExecutable",
                "properties": {
                    "agentPath": {
                        "alias": "agentId,agentName",
                        "type": "string",
                        "pattern": "^[^<>]*$",
                        "maxLength": 255,
                        "minLength": 1
                    },
                    "subagentSelectionId": {
                        "alias": "subagentClusterId",
                        "type": "string",
                        "pattern": "^[^<>]*$",
                        "maxLength": 255,
                        "minLength": 1
                    },
                    "subagentSelectionIdExpr": {
                        "alias": "subagentClusterIdExpr",
                        "type": "string",
                        "pattern": "^[^<>]*$",
                        "maxLength": 255,
                        "minLength": 1
                    },
                    "executable": {
                        "javaType": "com.sos.sign.model.job.Executable",
                        "oneOf": [
                            {
                                "javaType": "com.sos.sign.model.job.ExecutableScript",
                                "type": "object",
                                "extends": {
                                    "javaType": "com.sos.sign.model.job.Executable",
                                    "type": "object",
                                    "required": [
                                        "TYPE"
                                    ],
                                    "properties": {
                                        "TYPE": {
                                            "javaType": "com.sos.inventory.model.job.ExecutableType",
                                            "type": "string",
                                            "enum": [
                                                "ShellScriptExecutable",
                                                "ScriptExecutable",
                                                "InternalExecutable"
                                            ],
                                            "javaEnumNames": [
                                                "ShellScriptExecutable",
                                                "ScriptExecutable",
                                                "InternalExecutable"
                                            ]
                                        }
                                    },
                                    "additionalProperties": false
                                },
                                "required": [
                                    "script"
                                ],
                                "propertyOrder": [
                                    "TYPE",
                                    "script",
                                    "env",
                                    "v1Compatible"
                                ],
                                "description": "executable with fixed property 'TYPE':'ShellScriptExecutable'",
                                "properties": {
                                    "script": {
                                        "type": "string",
                                        "minLength": 1
                                    },
                                    "env": {
                                        "description": "a map for arbitrary key-value pairs",
                                        "javaType": "com.sos.inventory.model.job.Environment",
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "string"
                                        }
                                    },
                                    "v1Compatible": {
                                        "type": "boolean",
                                        "default": false
                                    },
                                    "returnCodeMeaning": {
                                        "javaType": "com.sos.sign.model.job.JobReturnCode",
                                        "type": "object",
                                        "oneOf": [
                                            {
                                                "required": [
                                                    "success"
                                                ]
                                            },
                                            {
                                                "required": [
                                                    "failure"
                                                ]
                                            }
                                        ],
                                        "properties": {
                                            "success": {
                                                "type": "array",
                                                "minItems": 1,
                                                "items": {
                                                    "type": "integer"
                                                }
                                            },
                                            "failure": {
                                                "type": "array",
                                                "minItems": 1,
                                                "items": {
                                                    "type": "integer"
                                                }
                                            }
                                        },
                                        "additionalProperties": false
                                    },
                                    "login": {
                                        "type": "object",
                                        "javaType": "com.sos.inventory.model.job.ExecutableScriptLogin",
                                        "required": [
                                            "credentialKey"
                                        ],
                                        "properties": {
                                            "credentialKey": {
                                                "type": "string",
                                                "minLength": 1
                                            },
                                            "withUserProfile": {
                                                "type": "boolean",
                                                "default": false
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                },
                                "additionalProperties": false
                            },
                            {
                                "javaType": "com.sos.sign.model.job.ExecutableJava",
                                "type": "object",
                                "extends": {
                                    "javaType": "com.sos.sign.model.job.Executable",
                                    "type": "object",
                                    "required": [
                                        "TYPE"
                                    ],
                                    "properties": {
                                        "TYPE": {
                                            "javaType": "com.sos.inventory.model.job.ExecutableType",
                                            "type": "string",
                                            "enum": [
                                                "ShellScriptExecutable",
                                                "ScriptExecutable",
                                                "InternalExecutable"
                                            ],
                                            "javaEnumNames": [
                                                "ShellScriptExecutable",
                                                "ScriptExecutable",
                                                "InternalExecutable"
                                            ]
                                        }
                                    },
                                    "additionalProperties": false
                                },
                                "required": [
                                    "className"
                                ],
                                "propertyOrder": [
                                    "TYPE",
                                    "className"
                                ],
                                "description": "executable with fixed property 'TYPE':'InternalExecutable'",
                                "properties": {
                                    "className": {
                                        "type": "string",
                                        "minLength": 1
                                    },
                                    "jobArguments": {
                                        "description": "a map for arbitrary key-value pairs",
                                        "javaType": "com.sos.inventory.model.common.Variables",
                                        "type": "object",
                                        "additionalProperties": true
                                    },
                                    "arguments": {
                                        "description": "a map for arbitrary key-value pairs",
                                        "javaType": "com.sos.inventory.model.job.Environment",
                                        "type": "object",
                                        "additionalProperties": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "additionalProperties": false
                            }
                        ]
                    },
                    "admissionTimeScheme": {
                        "javaType": "com.sos.inventory.model.job.AdmissionTimeScheme",
                        "type": "object",
                        "required": [
                            "periods"
                        ],
                        "properties": {
                            "periods": {
                                "type": "array",
                                "items": {
                                    "javaType": "com.sos.inventory.model.job.AdmissionTimePeriod",
                                    "type": "object",
                                    "properties": {
                                        "TYPE": {
                                            "javaType": "com.sos.inventory.model.job.AdmissionTimePeriodType",
                                            "type": "string",
                                            "enum": [
                                                "MonthlyDatePeriod",
                                                "MonthlyLastDatePeriod",
                                                "MonthlyWeekdayPeriod",
                                                "MonthlyLastWeekdayPeriod",
                                                "WeekdayPeriod",
                                                "DailyPeriod",
                                                "SpecificDatePeriod"
                                            ]
                                        },
                                        "duration": {
                                            "type": "number",
                                            "format": "utc-millisec",
                                            "minimum": 0
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            }
                        },
                        "additionalProperties": false
                    },
                    "skipIfNoAdmissionStartForOrderDay": {
                        "alias": "skipIfNoAdmissionForOrderDay",
                        "type": "boolean",
                        "default": false
                    },
                    "returnCodeMeaning": {
                        "javaType": "com.sos.sign.model.job.JobReturnCode",
                        "type": "object",
                        "oneOf": [
                            {
                                "required": [
                                    "success"
                                ]
                            },
                            {
                                "required": [
                                    "failure"
                                ]
                            }
                        ],
                        "properties": {
                            "success": {
                                "type": "array",
                                "minItems": 1,
                                "items": {
                                    "type": "integer"
                                }
                            },
                            "failure": {
                                "type": "array",
                                "minItems": 1,
                                "items": {
                                    "type": "integer"
                                }
                            }
                        },
                        "additionalProperties": false
                    },
                    "parallelism": {
                        "alias": "taskLimit",
                        "type": "integer",
                        "minimum": 1,
                        "default": 1
                    },
                    "timeout": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "sigkillDelay": {
                        "alias": "graceTimeout",
                        "description": "in seconds",
                        "type": "integer",
                        "minimum": 0,
                        "default": 15
                    },
                    "failOnErrWritten": {
                        "type": "boolean",
                        "default": false
                    },
                    "jobClass": {
                        "description": "absolute path of an object.",
                        "type": "string",
                        "pattern": "^(/|(/[^/\\<>?:\"|*]+)+)$",
                        "maxLength": 255,
                        "minLength": 1
                    },
                    "defaultArguments": {
                        "description": "a map for arbitrary key-value pairs",
                        "javaType": "com.sos.inventory.model.job.Environment",
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "jobResourcePaths": {
                        "alias": "jobResourceNames",
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": "^[^<>]*$",
                            "maxLength": 255
                        }
                    }
                },
                "additionalProperties": false
            }
        }
    },
    "additionalProperties": false
}