{
    "title": "workflow",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "javaType": "com.sos.jobscheduler.model.workflow.Workflow",
    "type": "object",
    "javaInterfaces": [
        "com.sos.joc.model.common.IConfigurationObject",
        "com.sos.joc.model.common.IDeployObject"
    ],
    "required": [
        "instructions",
        "jobs"
    ],
    "propertyOrder": [
        "TYPE",
        "path",
        "versionId",
        "instructions",
        "jobs"
    ],
    "description": "deploy object with fixed property 'TYPE':'Workflow'",
    "properties": {
        "TYPE": {
            "javaType": "com.sos.jobscheduler.model.deploy.DeployType",
            "type": "string",
            "enum": [
                "Workflow",
                "JobClass",
                "Lock",
                "Junction"
            ],
            "javaEnumNames": [
                "Workflow",
                "JobClass",
                "Lock",
                "Junction"
            ],
            "default": "Workflow"
        },
        "path": {
            "description": "absolute path of an object.",
            "type": "string",
            "pattern": "^(/|(/[^/\\<>?:\"|*]+)+)$",
            "maxLength": 255,
            "minLength": 1
        },
        "versionId": {
            "type": "string",
            "pattern": "^[^<>]*$",
            "maxLength": 255
        },
        "instructions": {
            "type": "array",
            "minItems": 1,
            "items": {
                "javaType": "com.sos.jobscheduler.model.instruction.Instruction",
                "type": "object",
                "required": [
                    "TYPE"
                ],
                "properties": {
                    "TYPE": {
                        "javaType": "com.sos.jobscheduler.model.instruction.InstructionType",
                        "type": "string",
                        "enum": [
                            "Execute.Named",
                            "If",
                            "Try",
                            "Fork",
                            "Finish",
                            "Fail",
                            "Retry",
                            "Publish",
                            "Await"
                        ]
                    },
                    "position": {
                        "description": "Actually, each even item is a string, each odd item is an integer",
                        "type": "array",
                        "items": {
                            "anyOf": [
                                {
                                    "type": "integer"
                                },
                                {
                                    "type": "string"
                                }
                            ]
                        }
                    }
                },
                "additionalProperties": false
            }
        },
        "title": {
            "type": "string",
            "pattern": "^[^<>]*$",
            "maxLength": 255
        },
        "documentationId": {
            "type": "number",
            "format": "utc-millisec",
            "minimum": 0
        },
        "jobs": {
            "javaType": "com.sos.jobscheduler.model.workflow.Jobs",
            "type": "object",
            "additionalProperties": {
                "javaType": "com.sos.jobscheduler.model.job.Job",
                "type": "object",
                "javaInterfaces": [
                    "com.sos.joc.model.common.IConfigurationObject"
                ],
                "required": [
                    "agentName",
                    "executable",
                    "taskLimit"
                ],
                "properties": {
                    "agentName": {
                        "type": "string",
                        "pattern": "^[^<>]*$",
                        "maxLength": 255
                    },
                    "executable": {
                        "javaType": "com.sos.jobscheduler.model.job.ExecutableScript",
                        "type": "object",
                        "required": [
                            "TYPE",
                            "script"
                        ],
                        "propertyOrder": [
                            "TYPE",
                            "script"
                        ],
                        "properties": {
                            "script": {
                                "type": "string",
                                "minLength": 1
                            },
                            "TYPE": {
                                "type": "string",
                                "enum": [
                                    "ExecutableScript"
                                ],
                                "javaEnumNames": [
                                    "ExecutableScript"
                                ],
                                "default": "ExecutableScript"
                            }
                        },
                        "additionalProperties": false
                    },
                    "returnCodeMeaning": {
                        "javaType": "com.sos.jobscheduler.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
                    },
                    "taskLimit": {
                        "type": "integer",
                        "minimum": 1,
                        "default": 1
                    },
                    "timeout": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "graceTimeout": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "jobClass": {
                        "description": "absolute path of a JobScheduler object.",
                        "type": "string",
                        "pattern": "^(/|(/[^/\\<>?:\"|*]+)+)$",
                        "maxLength": 255,
                        "minLength": 1
                    },
                    "defaultArguments": {
                        "description": "a map for arbitrary key-value pairs",
                        "javaType": "com.sos.jobscheduler.model.common.Variables",
                        "type": "object",
                        "returnCode": {
                            "type": "integer"
                        },
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "title": {
                        "type": "string",
                        "pattern": "^[^<>]*$",
                        "maxLength": 255
                    },
                    "documentationId": {
                        "type": "number",
                        "format": "utc-millisec",
                        "minimum": 0
                    },
                    "logLevel": {
                        "javaType": "com.sos.joc.model.inventory.common.JobLogLevel",
                        "type": "string",
                        "enum": [
                            "INFO",
                            "DEBUG",
                            "TRACE"
                        ]
                    },
                    "criticality": {
                        "javaType": "com.sos.joc.model.inventory.common.JobCriticality",
                        "type": "string",
                        "enum": [
                            "NORMAL",
                            "CRITICAL"
                        ]
                    },
                    "path": {
                        "description": "absolute path of a JobScheduler object.",
                        "type": "string",
                        "pattern": "^(/|(/[^/\\<>?:\"|*]+)+)$",
                        "maxLength": 255,
                        "minLength": 1
                    }
                },
                "additionalProperties": false
            }
        }
    },
    "additionalProperties": false
}