{
    "title": "JobTemplate",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "javaType": "com.sos.joc.model.jobtemplate.JobTemplate",
    "type": "object",
    "properties": {
        "deliveryDate": {
            "description": "Value is UTC timestamp in ISO 8601 YYYY-MM-DDThh:mm:ss.sZ or empty",
            "type": "string",
            "format": "date-time"
        },
        "jobTemplate": {
            "javaType": "com.sos.controller.model.jobtemplate.JobTemplate",
            "type": "object",
            "extends": {
                "javaType": "com.sos.inventory.model.jobtemplate.JobTemplate",
                "type": "object",
                "javaInterfaces": [
                    "com.sos.joc.model.common.IConfigurationObject",
                    "com.sos.joc.model.common.IReleaseObject",
                    "com.sos.inventory.model.common.IInventoryObject"
                ],
                "required": [
                    "executable"
                ],
                "properties": {
                    "version": {
                        "description": "inventory repository version",
                        "type": "string",
                        "pattern": "[0-9]+\\.[0-9]+\\.[0-9]+",
                        "default": "1.5.2",
                        "maxLength": 20
                    },
                    "executable": {
                        "javaType": "com.sos.inventory.model.job.Executable",
                        "oneOf": [
                            {
                                "javaType": "com.sos.inventory.model.job.ExecutableScript",
                                "type": "object",
                                "extends": {
                                    "javaType": "com.sos.inventory.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.inventory.model.job.JobReturnCode",
                                        "type": "object",
                                        "extends": {
                                            "javaType": "com.sos.inventory.model.job.JobReturnCodeWarning",
                                            "type": "object",
                                            "properties": {
                                                "warning": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string",
                                                            "pattern": "^-?[0-9]+(\\.\\.-?[0-9]+)?(, *-?[0-9]+(\\.\\.-?[0-9]+)?)*$"
                                                        },
                                                        {
                                                            "type": "array",
                                                            "minItems": 1,
                                                            "items": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    ]
                                                }
                                            },
                                            "additionalProperties": false
                                        },
                                        "anyOf": [
                                            {
                                                "required": [
                                                    "success"
                                                ]
                                            },
                                            {
                                                "required": [
                                                    "failure"
                                                ]
                                            },
                                            {
                                                "required": [
                                                    "warning"
                                                ]
                                            }
                                        ],
                                        "properties": {
                                            "success": {
                                                "anyOf": [
                                                    {
                                                        "type": "string",
                                                        "pattern": "^-?[0-9]+(\\.\\.-?[0-9]+)?(, *-?[0-9]+(\\.\\.-?[0-9]+)?)*$"
                                                    },
                                                    {
                                                        "type": "array",
                                                        "minItems": 1,
                                                        "items": {
                                                            "type": "integer"
                                                        }
                                                    }
                                                ]
                                            },
                                            "failure": {
                                                "anyOf": [
                                                    {
                                                        "type": "string",
                                                        "pattern": "^(none|-?[0-9]+(\\.\\.-?[0-9]+)?(, *-?[0-9]+(\\.\\.-?[0-9]+)?)*)$"
                                                    },
                                                    {
                                                        "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.inventory.model.job.ExecutableJava",
                                "type": "object",
                                "extends": {
                                    "javaType": "com.sos.inventory.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",
                                    "script"
                                ],
                                "description": "executable with fixed property 'TYPE':'InternalExecutable'",
                                "properties": {
                                    "className": {
                                        "type": "string",
                                        "minLength": 1
                                    },
                                    "internalType": {
                                        "javaType": "com.sos.inventory.model.job.InternalExecutableType",
                                        "type": "string",
                                        "enum": [
                                            "JITL",
                                            "Java",
                                            "JavaScript_Graal",
                                            "JavaScript_Node"
                                        ],
                                        "javaEnumNames": [
                                            "JITL",
                                            "Java",
                                            "JavaScript_Graal",
                                            "JavaScript_Node"
                                        ]
                                    },
                                    "script": {
                                        "type": "string"
                                    },
                                    "jobArguments": {
                                        "description": "a map for arbitrary key-value pairs",
                                        "javaType": "com.sos.inventory.model.common.Variables",
                                        "type": "object",
                                        "additionalProperties": true
                                    },
                                    "returnCodeMeaning": {
                                        "javaType": "com.sos.inventory.model.job.JobReturnCodeWarning",
                                        "type": "object",
                                        "properties": {
                                            "warning": {
                                                "anyOf": [
                                                    {
                                                        "type": "string",
                                                        "pattern": "^-?[0-9]+(\\.\\.-?[0-9]+)?(, *-?[0-9]+(\\.\\.-?[0-9]+)?)*$"
                                                    },
                                                    {
                                                        "type": "array",
                                                        "minItems": 1,
                                                        "items": {
                                                            "type": "integer"
                                                        }
                                                    }
                                                ]
                                            }
                                        },
                                        "additionalProperties": false
                                    },
                                    "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
                    },
                    "skipIfNoAdmissionForOrderDay": {
                        "type": "boolean",
                        "default": false
                    },
                    "parallelism": {
                        "type": "integer",
                        "minimum": 1,
                        "default": 1
                    },
                    "timeout": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "graceTimeout": {
                        "description": "in seconds",
                        "type": "integer",
                        "minimum": 0,
                        "default": 1
                    },
                    "failOnErrWritten": {
                        "type": "boolean",
                        "default": false
                    },
                    "warnOnErrWritten": {
                        "type": "boolean",
                        "default": false
                    },
                    "arguments": {
                        "javaType": "com.sos.inventory.model.jobtemplate.Parameters",
                        "type": "object",
                        "additionalProperties": {
                            "javaType": "com.sos.inventory.model.jobtemplate.Parameter",
                            "type": "object",
                            "required": [
                                "type"
                            ],
                            "properties": {
                                "type": {
                                    "javaType": "com.sos.inventory.model.jobtemplate.ParameterType",
                                    "type": "string",
                                    "enum": [
                                        "String",
                                        "Number",
                                        "Boolean"
                                    ],
                                    "javaEnumNames": [
                                        "String",
                                        "Number",
                                        "Boolean"
                                    ]
                                },
                                "default": {
                                    "description": "this value has to have the data type of the 'type' attribute",
                                    "anyOf": [
                                        {
                                            "type": "string"
                                        },
                                        {
                                            "type": "number"
                                        },
                                        {
                                            "type": "boolean"
                                        }
                                    ],
                                    "javaType": "java.lang.Object"
                                },
                                "required": {
                                    "type": "boolean",
                                    "default": false
                                },
                                "description": {
                                    "type": "string",
                                    "pattern": "^(?s)((?!<script( |>)|<svg/on).)*$"
                                },
                                "facet": {
                                    "description": "a regular expression to check the value of the parameter",
                                    "type": "string"
                                },
                                "list": {
                                    "description": "enumeration of possible parameter values",
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "message": {
                                    "description": "a message if the value doesn't match the facet",
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false
                        }
                    },
                    "defaultArguments": {
                        "description": "a map for arbitrary key-value pairs",
                        "javaType": "com.sos.inventory.model.job.Environment",
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        }
                    },
                    "jobResourceNames": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": "^[^<>]*$",
                            "maxLength": 255
                        }
                    },
                    "title": {
                        "type": "string",
                        "pattern": "^[^<>]*$",
                        "maxLength": 255
                    },
                    "description": {
                        "type": "string",
                        "pattern": "^(?s)((?!<script( |>)|<svg/on).)*$"
                    },
                    "documentationName": {
                        "type": "string",
                        "pattern": "^[^<>]*$",
                        "maxLength": 255
                    },
                    "criticality": {
                        "javaType": "com.sos.inventory.model.job.JobCriticality",
                        "type": "string",
                        "enum": [
                            "NORMAL",
                            "CRITICAL"
                        ]
                    },
                    "warnIfShorter": {
                        "type": "string",
                        "pattern": "^([0-9]+:[0-5][0-9]:[0-5][0-9]|[0-9]+s?|[0-9]+%)$"
                    },
                    "warnIfLonger": {
                        "type": "string",
                        "pattern": "^([0-9]+:[0-5][0-9]:[0-5][0-9]|[0-9]+s?|[0-9]+%)$"
                    },
                    "notification": {
                        "javaType": "com.sos.inventory.model.job.notification.JobNotification",
                        "type": "object",
                        "properties": {
                            "types": {
                                "type": "array",
                                "items": {
                                    "javaType": "com.sos.inventory.model.job.notification.JobNotificationType",
                                    "type": "string",
                                    "enum": [
                                        "ERROR",
                                        "SUCCESS",
                                        "WARNING"
                                    ]
                                }
                            },
                            "mail": {
                                "javaType": "com.sos.inventory.model.job.notification.JobNotificationMail",
                                "type": "object",
                                "properties": {
                                    "to": {
                                        "type": "string",
                                        "pattern": "^[^<>]*$",
                                        "maxLength": 900
                                    },
                                    "cc": {
                                        "type": "string",
                                        "pattern": "^[^<>]*$",
                                        "maxLength": 900
                                    },
                                    "bcc": {
                                        "type": "string",
                                        "pattern": "^[^<>]*$",
                                        "maxLength": 900
                                    }
                                },
                                "additionalProperties": false
                            }
                        },
                        "additionalProperties": false
                    },
                    "hash": {
                        "type": "string",
                        "pattern": "^[^<>]*$",
                        "maxLength": 255
                    }
                },
                "additionalProperties": false
            },
            "properties": {
                "name": {
                    "type": "string",
                    "pattern": "^[^<>]*$",
                    "maxLength": 255
                },
                "path": {
                    "description": "absolute path of an object.",
                    "type": "string",
                    "pattern": "^(/|(/[^/\\\\<>?:\"|*]+)+)$",
                    "maxLength": 255,
                    "minLength": 1
                },
                "hasRequiredArguments": {
                    "type": "boolean",
                    "default": false
                }
            },
            "additionalProperties": false
        }
    },
    "additionalProperties": false
}