{
    "title": "job chain (permanent part)",
    "id": "schemas/jobChain/jobChain_p",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "javaType": "com.sos.joc.model.jobChain.JobChainP",
    "type": "object",
    "oneOf": [
        {
            "description": "compact=true then ONLY required fields are responded and optional title, maxOrders, distributed, processClass, fileWatchingProcessClass",
            "required": [
                "surveyDate",
                "path",
                "name",
                "numOfNodes"
            ]
        },
        {
            "description": "parameter compact=false or unset, all other fields are optional",
            "required": [
                "surveyDate",
                "path",
                "name",
                "numOfNodes",
                "nodes"
            ]
        }
    ],
    "properties": {
        "surveyDate": {
            "id": "schemas/common/surveyDate_p",
            "description": "Date of the inventory data. Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ",
            "type": "string",
            "format": "date-time"
        },
        "path": {
            "id": "schemas/common/path",
            "description": "absolute path based on live folder of a JobScheduler object.",
            "type": "string",
            "pattern": "/([^/]+/)*[^/]+"
        },
        "name": {
            "type": "string"
        },
        "title": {
            "type": "string"
        },
        "maxOrders": {
            "id": "schemas/common/nonNegativeInteger",
            "type": "integer",
            "minimum": 0
        },
        "distributed": {
            "type": "boolean"
        },
        "processClass": {
            "type": "string"
        },
        "fileWatchingProcessClass": {
            "type": "string"
        },
        "numOfNodes": {
            "id": "schemas/common/nonNegativeInteger",
            "type": "integer",
            "minimum": 0
        },
        "nodes": {
            "type": "array",
            "minItems": 1,
            "items": {
                "id": "schemas/jobchain/jobChainNode_p",
                "javaType": "com.sos.joc.model.jobChain.JobChainNodeP",
                "type": "object",
                "oneOf": [
                    {
                        "description": "job chain node object with assigned a job",
                        "required": [
                            "name",
                            "nextNode",
                            "errorNode",
                            "job",
                            "level"
                        ]
                    },
                    {
                        "description": "job chain node object with assigned a job chain",
                        "required": [
                            "name",
                            "nextNode",
                            "errorNode",
                            "jobChain"
                        ]
                    }
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "nextNode": {
                        "type": "string"
                    },
                    "errorNode": {
                        "type": "string"
                    },
                    "job": {
                        "javaType": "com.sos.joc.model.jobChain.JobChainNodeJobP",
                        "type": "object",
                        "required": [
                            "path"
                        ],
                        "properties": {
                            "path": {
                                "id": "schemas/common/path",
                                "description": "absolute path based on live folder of a JobScheduler object.",
                                "type": "string",
                                "pattern": "/([^/]+/)*[^/]+"
                            },
                            "processClass": {
                                "id": "schemas/common/path",
                                "description": "absolute path based on live folder of a JobScheduler object.",
                                "type": "string",
                                "pattern": "/([^/]+/)*[^/]+"
                            },
                            "documentation": {
                                "id": "schemas/common/path",
                                "description": "absolute path based on live folder of a JobScheduler object.",
                                "type": "string",
                                "pattern": "/([^/]+/)*[^/]+"
                            }
                        }
                    },
                    "jobChain": {
                        "description": "job chain object is included in nestedJobChains collection",
                        "javaType": "com.sos.joc.model.jobChain.JobChainNodeJobChainP",
                        "type": "object",
                        "required": [
                            "path"
                        ],
                        "properties": {
                            "path": {
                                "id": "schemas/common/path",
                                "description": "absolute path based on live folder of a JobScheduler object.",
                                "type": "string",
                                "pattern": "/([^/]+/)*[^/]+"
                            },
                            "documentation": {
                                "id": "schemas/common/path",
                                "description": "absolute path based on live folder of a JobScheduler object.",
                                "type": "string",
                                "pattern": "/([^/]+/)*[^/]+"
                            }
                        }
                    },
                    "level": {
                        "description": "Only relevant for job chain with splits and syncs. For example to imagine splits/sync in the job chain list view with different indents",
                        "type": "integer"
                    },
                    "onError": {
                        "description": "possible values are 'suspend', 'setback' or it isn't set",
                        "type": "string"
                    },
                    "delay": {
                        "id": "schemas/common/nonNegativeInteger",
                        "type": "integer",
                        "minimum": 0
                    },
                    "remove": {
                        "description": "for file order sink",
                        "type": "boolean"
                    },
                    "move": {
                        "description": "for file order sink, a directory path is expected",
                        "type": "string"
                    }
                }
            }
        },
        "fileOrderSources": {
            "type": "array",
            "items": {
                "id": "schemas/jobchain/fileWatchingNode_p",
                "javaType": "com.sos.joc.model.jobChain.FileWatchingNodeP",
                "type": "object",
                "required": [
                    "directory",
                    "regex"
                ],
                "properties": {
                    "directory": {
                        "type": "string"
                    },
                    "nextNode": {
                        "type": "string"
                    },
                    "regex": {
                        "type": "string"
                    }
                }
            }
        },
        "endNodes": {
            "description": "real end nodes or file sink nodes",
            "type": "array",
            "items": {
                "id": "schemas/jobchain/endNode",
                "javaType": "com.sos.joc.model.jobChain.EndNode",
                "type": "object",
                "required": [
                    "name"
                ],
                "properties": {
                    "name": {
                        "type": "string"
                    }
                }
            }
        },
        "configurationDate": {
            "id": "schemas/common/timestamp",
            "description": "Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ or empty",
            "type": "string",
            "format": "date-time"
        },
        "documentation": {
            "id": "schemas/common/path",
            "description": "absolute path based on live folder of a JobScheduler object.",
            "type": "string",
            "pattern": "/([^/]+/)*[^/]+"
        }
    }
}