{
	"name": "If-Then-Else Processor",
	"description": "A processor that evaluates a Tuktu predicate for each datum and applies a subflow to all datums satisfying the predicate and another to all datums that do not satisfy the predicate.",
	"class": "tuktu.processors.meta.IfThenElseProcessor",
	"parameters": [
		{
			"name": "id",
			"type": "string",
			"required": true
		},
		{
			"name": "result",
			"type": "string",
			"required": true
		},
		{
			"name": "config",
			"type": "object",
			"required": true,
			"parameters": [
				{
					"name": "name",
					"description": "The name to show in the monitor for the if- and else-branches.",
					"type": "string",
					"required": false,
					"default": "UNNAMED"
				},
			    {
					"name": "expression",
					"description": "The expression to evaluate, can be arithmetics, boolean logic and simple predicates like. Supported predicates are: containsFields(field.path.name,...), which checks the presence of all given field paths -- isNumeric(field), which checks if the field is numeric -- isJSON(field.path.name,...), which checks if all given paths exists and are JSON values -- isNull(field), which checks if the field is null -- isEmpty(), which checks if the datum is empty (ie. contains no keys) -- isEmptyValue(field), which checks if a field contains an empty value (empty string, empty Seq, empty Map) -- listSize(field, operator, check), which checks if a field of type Seq[Any] matches check using the specified operator (supported are ==, !=, >=, <=, >, <).",
					"type": "string",
					"required": true
				},
				{
					"name": "evaluate",
					"description": "Evaluate the expression first. This is required when the (whole) expression (or parts of it) comes from the datum, e.g. when the expression is '${expression}' with expression -> ${field} == \"Value\" in the datum. This is not required when only basic values from the datum are used, e.g. ${field} == \"Value\" with field -> \"Value\" in the datum.",
					"type": "boolean",
					"required": false,
					"default": true
				},
				{
					"name": "constant",
					"description": "Only relevant if evaluate above is true, otherwise the expression is obviously constant across all Datums and DataPackets. If evaluate above is true, this option expresses whether the expression is the same across all DataPackets and all Datums (enter 'global'), is the same for all Datums within each separate DataPacket (enter 'local'), or can differ even within DataPackets (enter 'no').",
					"type": "string",
					"required": false,
					"default": "no"
				},
				{
                    "name": "default",
                    "description": "The default to be used if the evaluating the expression results in an error. Leave empty to throw an error and kill the flow, or use true or false.",
                    "type": "string",
                    "required": false
                },
				{
					"name": "then_pipeline",
					"description": "The then-pipeline. This points to a config file and start processor to execute on all datums satisfying the predicate.",
					"type": "object",
					"required": true,
					"parameters": [
						{
							"name": "config",
							"label": "Then Config File",
							"description": "The name of the config file that contains the subflow for all datums satisfying the predicate.",
							"type": "string",
							"required": true
						},
						{
							"name": "start",
							"label": "Then Start Processor",
							"description": "The name of the start processor for all datums satisfying the predicate.",
							"type": "string",
							"required": true
						}
					]
				},
				{
					"name": "else_pipeline",
					"description": "The else-pipeline. This points to a config file and start processor to execute on all datums NOT satisfying the predicate.",
					"type": "object",
					"required": true,
					"parameters": [
						{
							"name": "config",
							"label": "Else Config File",
							"description": "The name of the config file that contains the subflow for all datums NOT satisfying the predicate.",
							"type": "string",
							"required": true
						},
						{
							"name": "start",
							"label": "Else Start Processor",
							"description": "The name of the start processor for all datums NOT satisfying the predicate.",
							"type": "string",
							"required": true
						}
					]
				}
			]
		}
	]
}