{
    "title": "edit job chain configuration",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "javaType": "com.sos.joc.model.joe.jobchain.JobChainEdit",
    "type": "object",
    "required": [
        "configuration"
    ],
    "extends": {
        "javaType": "com.sos.joc.model.joe.common.JSObjectEdit"
    },
    "properties": {
        "configuration": {
            "javaType": "com.sos.joc.model.joe.jobchain.JobChain",
            "type": "object",
            "javaInterfaces": [
                "com.sos.joc.model.joe.common.IJSObject"
            ],
            "properties": {
                "ordersRecoverable": {
                    "description": "possible values: yes, no, 1, 0, true, false",
                    "type": "string",
                    "default": "true"
                },
                "title": {
                    "type": "string"
                },
                "maxOrders": {
                    "type": "integer",
                    "minimum": 0
                },
                "distributed": {
                    "description": "possible values: yes, no, 1, 0, true, false",
                    "type": "string",
                    "default": "false"
                },
                "processClass": {
                    "description": "path of a process class object",
                    "type": "string"
                },
                "fileWatchingProcessClass": {
                    "description": "path of a process class object",
                    "type": "string"
                },
                "fileOrderSources": {
                    "xmlElement": "file_order_source",
                    "type": "array",
                    "items": {
                        "javaType": "com.sos.joc.model.joe.jobchain.FileOrderSource",
                        "type": "object",
                        "required": [
                            "directory"
                        ],
                        "properties": {
                            "directory": {
                                "type": "string"
                            },
                            "regex": {
                                "type": "string"
                            },
                            "repeat": {
                                "description": "possible values: 'no' or positive number",
                                "type": "string"
                            },
                            "delayAfterError": {
                                "type": "integer",
                                "minimum": 0
                            },
                            "max": {
                                "type": "integer",
                                "minimum": 0
                            },
                            "nextState": {
                                "type": "string"
                            },
                            "alertWhenDirectoryMissing": {
                                "description": "possible values: yes, no, 1, 0, true, false",
                                "type": "string",
                                "default": "true"
                            }
                        }
                    }
                },
                "jobChainNodes": {
                    "xmlElement": "job_chain_node",
                    "type": "array",
                    "items": {
                        "javaType": "com.sos.joc.model.joe.jobchain.JobChainNode",
                        "type": "object",
                        "extends": {
                            "javaType": "JobChainEndNode"
                        },
                        "properties": {
                            "job": {
                                "description": "path to job",
                                "type": "string"
                            },
                            "nextState": {
                                "description": "name of the next job chain node in successful case",
                                "type": "string"
                            },
                            "errorState": {
                                "description": "name of the next job chain node in erroneous case",
                                "type": "string"
                            },
                            "onError": {
                                "description": "possible values: suspend and setback",
                                "type": "string"
                            },
                            "delay": {
                                "type": "integer",
                                "minimum": 0
                            },
                            "onReturnCodes": {
                                "type": "object",
                                "javaType": "com.sos.joc.model.joe.jobchain.OnReturnCodes",
                                "properties": {
                                    "onReturnCodeList": {
                                        "xmlElement": "on_return_code",
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "javaType": "com.sos.joc.model.joe.jobchain.OnReturnCode",
                                            "required": [
                                                "returnCode"
                                            ],
                                            "properties": {
                                                "returnCode": {
                                                    "type": "string"
                                                },
                                                "toState": {
                                                    "type": "object",
                                                    "javaType": "com.sos.joc.model.joe.jobchain.ToState",
                                                    "required": [
                                                        "state"
                                                    ],
                                                    "properties": {
                                                        "state": {
                                                            "description": "name of a job chain node",
                                                            "type": "string"
                                                        }
                                                    }
                                                },
                                                "addOrders": {
                                                    "xmlElement": "add_order",
                                                    "type": "array",
                                                    "items": {
                                                        "javaType": "com.sos.joc.model.joe.order.ReturnCodeAddOrder",
                                                        "type": "object",
                                                        "required": [
                                                            "xmlns",
                                                            "jobChain"
                                                        ],
                                                        "properties": {
                                                            "xmlns": {
                                                                "type": "string",
                                                                "default": "https://jobscheduler-plugins.sos-berlin.com/NodeOrderPlugin"
                                                            },
                                                            "jobChain": {
                                                                "type": "string"
                                                            },
                                                            "id": {
                                                                "type": "string"
                                                            },
                                                            "params": {
                                                                "javaType": "com.sos.joc.model.joe.common.Params",
                                                                "type": "object",
                                                                "properties": {
                                                                    "includes": {
                                                                        "xmlElement": "include",
                                                                        "type": "array",
                                                                        "items": {
                                                                            "javaType": "com.sos.joc.model.joe.common.ParamInclude",
                                                                            "xmlElement": "include",
                                                                            "type": "object",
                                                                            "properties": {
                                                                                "file": {
                                                                                    "type": "string"
                                                                                },
                                                                                "liveFile": {
                                                                                    "type": "string"
                                                                                },
                                                                                "node": {
                                                                                    "type": "string"
                                                                                }
                                                                            }
                                                                        }
                                                                    },
                                                                    "copyParams": {
                                                                        "decription": "Only valid in start_job and add_order. Possible values for 'from' is task or order.",
                                                                        "type": "array",
                                                                        "uniqueItems": true,
                                                                        "items": {
                                                                            "type": "object",
                                                                            "javaType": "com.sos.joc.model.joe.common.CopyParams",
                                                                            "xmlElement": "copy_params",
                                                                            "required": [
                                                                                "from"
                                                                            ],
                                                                            "properties": {
                                                                                "from": {
                                                                                    "type": "string"
                                                                                }
                                                                            }
                                                                        }
                                                                    },
                                                                    "paramList": {
                                                                        "xmlElement": "param",
                                                                        "type": "array",
                                                                        "items": {
                                                                            "javaType": "com.sos.joc.model.joe.common.Param",
                                                                            "type": "object",
                                                                            "required": [
                                                                                "name",
                                                                                "value"
                                                                            ],
                                                                            "properties": {
                                                                                "name": {
                                                                                    "type": "string"
                                                                                },
                                                                                "value": {
                                                                                    "type": "string"
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "fileOrderSinks": {
                    "xmlElement": "file_order_sink",
                    "type": "array",
                    "items": {
                        "javaType": "com.sos.joc.model.joe.jobchain.FileOrderSink",
                        "type": "object",
                        "required": [
                            "state"
                        ],
                        "properties": {
                            "state": {
                                "description": "name of the job chain node",
                                "type": "string"
                            },
                            "moveTo": {
                                "description": "path of the target folder",
                                "type": "string"
                            },
                            "remove": {
                                "description": "possible values: yes, no, 1, 0, true, false",
                                "type": "string"
                            },
                            "delay": {
                                "type": "integer",
                                "minimum": 0
                            }
                        }
                    }
                },
                "nestedJobChainNodes": {
                    "xmlElement": "job_chain_node.job_chain",
                    "type": "array",
                    "items": {
                        "javaType": "com.sos.joc.model.joe.jobchain.NestedJobChainNode",
                        "type": "object",
                        "xmlElement": "job_chain_node.job_chain",
                        "extends": {
                            "javaType": "JobChainEndNode"
                        },
                        "properties": {
                            "jobChain": {
                                "description": "path to job chain",
                                "type": "string"
                            },
                            "nextState": {
                                "description": "name of the next job chain node in successful case",
                                "type": "string"
                            },
                            "errorState": {
                                "description": "name of the next job chain node in errornous case",
                                "type": "string"
                            }
                        }
                    }
                },
                "jobChainEndNodes": {
                    "xmlElement": "job_chain_node.end",
                    "type": "array",
                    "items": {
                        "javaType": "com.sos.joc.model.joe.jobchain.JobChainEndNode",
                        "type": "object",
                        "xmlElement": "job_chain_node.end",
                        "required": [
                            "state"
                        ],
                        "properties": {
                            "state": {
                                "description": "name of the job chain node",
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    }
}