{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Automation Template Definitions",
    "description": "This schema is used for verification of JSON objects used for creation of Automation Object Templates.",
    "oneOf": [
        {
            "type": "object",
            "title": "Rule Template",
            "description": "Rule Template Definition",
            "additionalProperties": false,
            "required": [
                "uid",
                "triggers",
                "actions"
            ],
            "properties": {
                "label": {
                    "type": "string",
                    "title": "Rule Template Label",
                    "description": "Short (one word) user friendly name of the Rule Template."
                },
                "uid": {
                    "type": "string",
                    "pattern": "[A-Za-z0-9_-]*",
                    "title": "Rule Template UID",
                    "description": "An unique identifier of the Rule Template in scope of the Template Registry."
                },
                "tags": {
                    "type": "array",
                    "title": "Rule Template Tags",
                    "description": "Non-hierarchical keywords or terms describing the Rule. They help to classify the rule templates and allow them to be found.",
                    "minItems": 1,
                    "items": {
                        "type": "string",
                        "title": "Tag",
                        "description": "Keyword or term describing the Rule Template."
                    }
                },
                "description": {
                    "type": "string",
                    "title": "Rule Template Description",
                    "description": "A brief description of what the rule is and for what it is used."
                },
                "visibility": {
                    "enum": [
                        "VISIBLE",
                        "HIDDEN",
                        "EXPERT"
                    ],
                    "default": "VISIBLE",
                    "title": "Visibility",
                    "description": "Defines visibility of the Rule Template."
                },
                "configDescriptions": {
                    "type": "array",
                    "title": "Rule Template Configuration Descriptor",
                    "description": "Used to describe the configuration parameters of the Rule Template.",
                    "minItems": 1,
                    "items": {
                        "type": "object",
                        "title": "Configuration Property Description",
                        "description": "Description of property for configuring the Rule Template.",
                        "additionalProperties": false,
                        "required": [
                            "name",
                            "type"
                        ],
                        "properties": {
                            "name": {
                                "pattern": "[A-Za-z0-9_-]*",
                                "type": "string",
                                "title": "Configuration Parameter Name",
                                "description": "Identifies uniquely the configuration parameter in scope of the Rule Template."
                            },
                            "type": {
                                "enum": [
                                    "TEXT",
                                    "INTEGER",
                                    "DECIMAL",
                                    "BOOLEAN"
                                ],
                                "title": "Configuration Parameter Type",
                                "description": "Property declaring the data type of the configuration parameter."
                            },
                            "label": {
                                "type": "string",
                                "title": "Configuration Parameter Label",
                                "description": "A human understandable label of the Configuration Parameter."
                            },
                            "description": {
                                "type": "string",
                                "title": "Configuration Parameter Description",
                                "description": "A human understandable description of the Configuration Parameter."
                            },
                            "required": {
                                "type": "boolean",
                                "default": false,
                                "title": "Required Configuration Parameter",
                                "description": "Specifies whether the value is required."
                            },
                            "min": {
                                "type": "number",
                                "title": "Configuration Parameter Minimum Allowed Value",
                                "description": "The minimal value for numeric types, or the minimal length of strings, or the minimal number of selected options."
                            },
                            "max": {
                                "type": "number",
                                "title": "Configuration Parameter Maximum Allowed Value",
                                "description": "The maximal value for numeric types, or the maximal length of strings, or the maximal number of selected options."
                            },
                            "step": {
                                "type": "number",
                                "title": "Configuration Parameter Step",
                                "description": "The value granularity for a numeric value"
                            },
                            "pattern": {
                                "type": "string",
                                "title": "Configuration Parameter Pattern",
                                "description": "The regular expression for a text type."
                            },
                            "readOnly": {
                                "type": "boolean",
                                "default": false,
                                "title": "Readable Configuration Parameter",
                                "description": "Specifies whether the value is read-only."
                            },
                            "multiple": {
                                "type": "boolean",
                                "default": false,
                                "title": "Multiple Configuration Parameter",
                                "description": "Specifies whether multiple selections of options are allowed."
                            },
                            "multipleLimit": {
                                "type": "number",
                                "title": "Multiple Configuration Parameter Limit",
                                "description": "Specifies the maximum number of options that can be selected when multiple is true."
                            },
                            "context": {
                                "type": "string",
                                "title": "Configuration Parameter Context",
                                "description": "Serves to determine how to treat the value of the Configuration Parameter."
                            },
                            "defaultValue": {
                                "type": "string",
                                "title": "Configuration Parameter Default Value",
                                "description": "Declaring a default value for the Configuration Parameter if missing."
                            },
                            "unit": {
                                "type": "string",
                                "title": "Configuration Parameter Unit",
                                "description": "Specifies the unit of measurements for the configuration parameter."
                            },
                            "unitLabel": {
                                "type": "string",
                                "title": "Configuration Parameter Unit Label",
                                "description": "Specifies the unit label for the configuration parameter. This attribute can also be used to provide natural language units as iterations, runs, etc."
                            },
                            "filterCriteria": {
                                "type": "array",
                                "title": "Configuration Parameter Filter",
                                "description": "Criteria for dynamic selection of values.",
                                "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                        "name",
                                        "value"
                                    ],
                                    "properties": {
                                        "name": {
                                            "type": "string"
                                        },
                                        "value": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "options": {
                                "type": "array",
                                "title": "Configuration Parameter Options",
                                "description": "List of definitions of the parameter for static selection.",
                                "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                        "label",
                                        "value"
                                    ],
                                    "properties": {
                                        "label": {
                                            "type": "string"
                                        },
                                        "value": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "limitToOptions": {
                                "type": "boolean",
                                "default": false,
                                "title": "limit To Options",
                                "description": "Specifies that the users input is limited to the options list. When set to true without options, this should have no affect. When set to true with options, the user can only select the options from the list When set to false with options, the user can enter values other than those in the list."
                            },
                            "groupName": {
                                "type": "string",
                                "title": "Configuration Parameter Group Name",
                                "description": "A string used to group parameters together into logical blocks so that the UI can display them together."
                            },
                            "advanced": {
                                "type": "boolean",
                                "default": false,
                                "title": "An Advanced Configuration Parameter",
                                "description": "Specifies if this is an advanced parameter. An advanced parameter can be hidden in the UI to focus the user on important configuration."
                            }
                        }
                    }
                },
                "triggers": {
                    "type": "array",
                    "minItems": 1,
                    "title": "Trigger Modules",
                    "description": "Contains definitions of the Trigger Modules of the Rule Template.",
                    "items": {
                        "type": "object",
                        "title": "Trigger Module",
                        "description": "Defines the fact which triggers the Rule execution.",
                        "additionalProperties": false,
                        "required": [
                            "id",
                            "type"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "pattern": "[A-Za-z0-9_-]*",
                                "title": "Trigger ID",
                                "description": "Identifies uniquely the Module in scope of the Rule Template."
                            },
                            "label": {
                                "type": "string",
                                "title": "Trigger Label",
                                "description": "Short (one word) user friendly name of the Module."
                            },
                            "description": {
                                "type": "string",
                                "title": "Trigger Description",
                                "description": "A brief description of what the Trigger is and for what it is used."
                            },
                            "type": {
                                "type": "string",
                                "pattern": "[A-Za-z0-9_-]*",
                                "title": "Trigger Module Type UID",
                                "description": "Identifies the Module Type used for creation of the Trigger Module."
                            },
                            "configuration": {
                                "type": "object",
                                "title": "Trigger Configuration",
                                "description": "Used to define values of the configuration parameters of the Trigger."
                            }
                        }
                    }
                },
                "conditions": {
                    "type": "array",
                    "minItems": 1,
                    "title": "Condition Modules",
                    "description": "Contains definitions of Condition Modules of the Rule Template.",
                    "items": {
                        "type": "object",
                        "title": "Condition Module",
                        "description": "Defines the condition which permit to proceed with the Rule execution.",
                        "additionalProperties": false,
                        "required": [
                            "id",
                            "type"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "pattern": "[A-Za-z0-9_-]*",
                                "title": "Condition uid",
                                "description": "Identifies uniquely the Module in scope of the Rule Template."
                            },
                            "label": {
                                "type": "string",
                                "title": "Condition Label",
                                "description": "Short (one word) user friendly name of the Module."
                            },
                            "description": {
                                "type": "string",
                                "title": "Condition Description",
                                "description": "A brief description of what the Condition is and for what it is used."
                            },
                            "type": {
                                "type": "string",
                                "pattern": "[A-Za-z0-9_-]*",
                                "title": "Condition Module Type UID",
                                "description": "Identifies the Module Type used for creation of the Condition."
                            },
                            "configuration": {
                                "type": "object",
                                "title": "Condition Configuration",
                                "description": "Used to define values of the configuration parameters of the Condition."
                            },
                            "inputs": {
                                "type": "object",
                                "title": "Condition Input",
                                "description": "Contains pairs of Input Name and Output reference in format - Module ID : Output Name."
                            }
                        }
                    }
                },
                "actions": {
                    "type": "array",
                    "minItems": 1,
                    "title": "Action Modules",
                    "description": "Contains definitions of Action Modules of the Rule Template.",
                    "items": {
                        "type": "object",
                        "title": "Action Module",
                        "description": "Defines an Action which has to be executed by the Rule.",
                        "additionalProperties": false,
                        "required": [
                            "id",
                            "type"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "pattern": "[A-Za-z0-9_-]*",
                                "title": "Action ID",
                                "description": "Identifies uniquely the Module in scope of the Rule Template."
                            },
                            "label": {
                                "type": "string",
                                "title": "Action Label",
                                "description": "Short (one word) user friendly name of the Module."
                            },
                            "description": {
                                "type": "string",
                                "title": "Action Description",
                                "description": "A brief description of what the Action is and for what it is used."
                            },
                            "type": {
                                "type": "string",
                                "pattern": "[A-Za-z0-9_-]*",
                                "title": "Action Module Type UID",
                                "description": "Identifies the Module Type used for creation of the Action."
                            },
                            "configuration": {
                                "type": "object",
                                "title": "Action Configuration",
                                "description": "Used to define values of the configuration parameters of the Action."
                            },
                            "inputs": {
                                "type": "object",
                                "title": "Action Input",
                                "description": "Contains pairs of Input Name and Output reference in format - Module ID : Output Name."
                            },
                            "outputs": {
                                "type": "object",
                                "title": "Action Output",
                                "description": "Contains pairs of Output Name and Output reference. The reference defines what part of a complex data has to be used as value of this output."
                            }
                        }
                    }
                }
            }
        },
        {
            "type": "array",
            "minItems": 1,
            "items": {
                "type": "object",
                "title": "Rule Template",
                "description": "Rule Template Definition",
                "additionalProperties": false,
                "required": [
                    "uid",
                    "triggers",
                    "actions"
                ],
                "properties": {
                    "label": {
                        "type": "string",
                        "title": "Rule Template Label",
                        "description": "Short (one word) user friendly name of the Rule Template."
                    },
                    "uid": {
                        "type": "string",
                        "pattern": "[A-Za-z0-9_-]*",
                        "title": "Rule Template UID",
                        "description": "An unique identifier of the Rule Template in scope of the Template Registry."
                    },
                    "tags": {
                        "type": "array",
                        "title": "Rule Template Tags",
                        "description": "Non-hierarchical keywords or terms describing the Rule. They help to classify the rule templates and allow them to be found.",
                        "minItems": 1,
                        "items": {
                            "type": "string",
                            "title": "Tag",
                            "description": "Keyword or term describing the Rule Template."
                        }
                    },
                    "description": {
                        "type": "string",
                        "title": "Rule Template Description",
                        "description": "A brief description of what the rule is and for what it is used."
                    },
                    "visibility": {
                        "enum": [
                            "VISIBLE",
                            "HIDDEN",
                            "EXPERT"
                        ],
                        "default": "VISIBLE",
                        "title": "Visibility",
                        "description": "Defines visibility of the Rule Template."
                    },
                    "configDescriptions": {
                        "type": "array",
                        "title": "Rule Template Configuration Descriptor",
                        "description": "Used to describe the configuration parameters of the Rule Template.",
                        "minItems": 1,
                        "items": {
                            "type": "object",
                            "title": "Configuration Property Description",
                            "description": "Description of property for configuring the Rule Template.",
                            "additionalProperties": false,
                            "required": [
                                "name",
                                "type"
                            ],
                            "properties": {
                                "name": {
                                    "pattern": "[A-Za-z0-9_-]*",
                                    "type": "string",
                                    "title": "Configuration Parameter Name",
                                    "description": "Identifies uniquely the configuration parameter in scope of the Rule Template."
                                },
                                "type": {
                                    "enum": [
                                        "TEXT",
                                        "INTEGER",
                                        "DECIMAL",
                                        "BOOLEAN"
                                    ],
                                    "title": "Configuration Parameter Type",
                                    "description": "Property declaring the data type of the configuration parameter."
                                },
                                "label": {
                                    "type": "string",
                                    "title": "Configuration Parameter Label",
                                    "description": "A human understandable label of the Configuration Parameter."
                                },
                                "description": {
                                    "type": "string",
                                    "title": "Configuration Parameter Description",
                                    "description": "A human understandable description of the Configuration Parameter."
                                },
                                "required": {
                                    "type": "boolean",
                                    "default": false,
                                    "title": "Required Configuration Parameter",
                                    "description": "Specifies whether the value is required."
                                },
                                "min": {
                                    "type": "number",
                                    "title": "Configuration Parameter Minimum Allowed Value",
                                    "description": "The minimal value for numeric types, or the minimal length of strings, or the minimal number of selected options."
                                },
                                "max": {
                                    "type": "number",
                                    "title": "Configuration Parameter Maximum Allowed Value",
                                    "description": "The maximal value for numeric types, or the maximal length of strings, or the maximal number of selected options."
                                },
                                "step": {
                                    "type": "number",
                                    "title": "Configuration Parameter Step",
                                    "description": "The value granularity for a numeric value"
                                },
                                "pattern": {
                                    "type": "string",
                                    "description": "The regular expression for a text type."
                                },
                                "readOnly": {
                                    "type": "boolean",
                                    "default": false,
                                    "title": "Readable Configuration Parameter",
                                    "description": "Specifies whether the value is read-only."
                                },
                                "multiple": {
                                    "type": "boolean",
                                    "default": false,
                                    "title": "Multiple Configuration Parameter",
                                    "description": "Specifies whether multiple selections of options are allowed."
                                },
                                "multipleLimit": {
                                    "type": "number",
                                    "title": "Multiple Configuration Parameter Limit",
                                    "description": "Specifies the maximum number of options that can be selected when multiple is true."
                                },
                                "context": {
                                    "type": "string",
                                    "title": "Configuration Parameter Context",
                                    "description": "Serves to determine how to treat the value of the Configuration Parameter."
                                },
                                "defaultValue": {
                                    "type": "string",
                                    "title": "Configuration Parameter Default Value",
                                    "description": "Declaring a default value for the Configuration Parameter if missing."
                                },
                                "unit": {
                                    "type": "string",
                                    "title": "Configuration Parameter Unit",
                                    "description": "Specifies the unit of measurements for the configuration parameter."
                                },
                                "unitLabel": {
                                    "type": "string",
                                    "title": "Configuration Parameter Unit Label",
                                    "description": "Specifies the unit label for the configuration parameter. This attribute can also be used to provide natural language units as iterations, runs, etc."
                                },
                                "filterCriteria": {
                                    "type": "array",
                                    "title": "Configuration Parameter Filter",
                                    "description": "Criteria for dynamic selection of values.",
                                    "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                            "name",
                                            "value"
                                        ],
                                        "properties": {
                                            "name": {
                                                "type": "string"
                                            },
                                            "value": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                },
                                "options": {
                                    "type": "array",
                                    "title": "Configuration Parameter Options",
                                    "description": "List of definitions of the parameter for static selection.",
                                    "items": {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                            "label",
                                            "value"
                                        ],
                                        "properties": {
                                            "label": {
                                                "type": "string"
                                            },
                                            "value": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                },
                                "limitToOptions": {
                                    "type": "boolean",
                                    "default": false,
                                    "title": "limit To Options",
                                    "description": "Specifies that the users input is limited to the options list. When set to true without options, this should have no affect. When set to true with options, the user can only select the options from the list When set to false with options, the user can enter values other than those in the list."
                                },
                                "groupName": {
                                    "type": "string",
                                    "title": "Configuration Parameter Group Name",
                                    "description": "A string used to group parameters together into logical blocks so that the UI can display them together."
                                },
                                "advanced": {
                                    "type": "boolean",
                                    "default": false,
                                    "title": "An Advanced Configuration Parameter",
                                    "description": "Specifies if this is an advanced parameter. An advanced parameter can be hidden in the UI to focus the user on important configuration."
                                }
                            }
                        }
                    },
                    "triggers": {
                        "type": "array",
                        "minItems": 1,
                        "title": "Trigger Modules",
                        "description": "Contains definitions of the Trigger Modules of the Rule Template.",
                        "items": {
                            "type": "object",
                            "title": "Trigger Module",
                            "description": "Defines the fact which triggers the Rule execution.",
                            "additionalProperties": false,
                            "required": [
                                "id",
                                "type"
                            ],
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "pattern": "[A-Za-z0-9_-]*",
                                    "title": "Trigger ID",
                                    "description": "Identifies uniquely the Module in scope of the Rule Template."
                                },
                                "label": {
                                    "type": "string",
                                    "title": "Trigger Label",
                                    "description": "Short (one word) user friendly name of the Module."
                                },
                                "description": {
                                    "type": "string",
                                    "title": "Trigger Description",
                                    "description": "A brief description of what the Trigger is and for what it is used."
                                },
                                "type": {
                                    "type": "string",
                                    "pattern": "[A-Za-z0-9_-]*",
                                    "title": "Trigger Module Type UID",
                                    "description": "Identifies the Module Type used for creation of the Trigger Module."
                                },
                                "configuration": {
                                    "type": "object",
                                    "title": "Trigger Configuration",
                                    "description": "Used to define values of the configuration parameters of the Trigger."
                                }
                            }
                        }
                    },
                    "conditions": {
                        "type": "array",
                        "minItems": 1,
                        "title": "Condition Modules",
                        "description": "Contains definitions of Condition Modules of the Rule Template.",
                        "items": {
                            "type": "object",
                            "title": "Condition Module",
                            "description": "Defines the condition which permit to proceed with the Rule execution.",
                            "additionalProperties": false,
                            "required": [
                                "id",
                                "type"
                            ],
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "pattern": "[A-Za-z0-9_-]*",
                                    "title": "Condition uid",
                                    "description": "Identifies uniquely the Module in scope of the Rule Template."
                                },
                                "label": {
                                    "type": "string",
                                    "title": "Condition Label",
                                    "description": "Short (one word) user friendly name of the Module."
                                },
                                "description": {
                                    "type": "string",
                                    "title": "Condition Description",
                                    "description": "A brief description of what the Condition is and for what it is used."
                                },
                                "type": {
                                    "type": "string",
                                    "pattern": "[A-Za-z0-9_-]*",
                                    "title": "Condition Module Type UID",
                                    "description": "Identifies the Module Type used for creation of the Condition."
                                },
                                "configuration": {
                                    "type": "object",
                                    "title": "Condition Configuration",
                                    "description": "Used to define values of the configuration parameters of the Condition."
                                },
                                "inputs": {
                                    "type": "object",
                                    "title": "Condition Inputs",
                                    "description": "Contains pairs of Input Name and Output reference in format - Module ID : Output Name."
                                }
                            }
                        }
                    },
                    "actions": {
                        "type": "array",
                        "minItems": 1,
                        "title": "Action Modules",
                        "description": "Contains definitions of Action Modules of the Rule Template.",
                        "items": {
                            "type": "object",
                            "title": "Action Module",
                            "description": "Defines an Action which has to be executed by the Rule.",
                            "additionalProperties": false,
                            "required": [
                                "id",
                                "type"
                            ],
                            "properties": {
                                "id": {
                                    "type": "string",
                                    "pattern": "[A-Za-z0-9_-]*",
                                    "title": "Action ID",
                                    "description": "Identifies uniquely the Module in scope of the Rule Template."
                                },
                                "label": {
                                    "type": "string",
                                    "title": "Action Label",
                                    "description": "Short (one word) user friendly name of the Module."
                                },
                                "description": {
                                    "type": "string",
                                    "title": "Action Description",
                                    "description": "A brief description of what the Action is and for what it is used."
                                },
                                "type": {
                                    "type": "string",
                                    "pattern": "[A-Za-z0-9_-]*",
                                    "title": "Action Module Type UID",
                                    "description": "Identifies the Module Type used for creation of the Action."
                                },
                                "configuration": {
                                    "type": "object",
                                    "title": "Action Configuration",
                                    "description": "Used to define values of the configuration parameters of the Action."
                                },
                                "inputs": {
                                    "type": "object",
                                    "title": "Action Inputs",
                                    "description": "Contains pairs of Input Name and Output reference in format - Module ID : Output Name."
                                },
                                "outputs": {
                                    "type": "object",
                                    "title": "Action Outputs",
                                    "description": "Contains pairs of Output Name and Output reference. The reference defines what part of a complex data has to be used as value of this output."
                                }
                            }
                        }
                    }
                }
            }
        }
    ]
}