{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "title": "WhatIfTemplatesResponse",
  "description": "WhatIfTemplatesResponse PI_JSON",
  "type": "object",
  "required": [
    "whatIfTemplates"
  ],
  "properties": {
    "whatIfTemplates": {
      "type": "array",
      "description": "WhatIfTemplates",
      "items": {
        "$ref": "#/definitions/WhatIfTemplate"
      }
    }
  },
  "definitions": {
    "WhatIfTemplate": {
      "type": "object",
      "required": [
        "id",
        "name",
        "properties",
        "defaultSingleRunWhatIfSetting",
        "overrulableSingleRunWhatIf"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the workflow"
        },
        "name": {
          "type": "string",
          "description": "The name of the workflow"
        },
        "properties": {
          "type": "array",
          "description": "WhatIfProperties",
          "items": {
            "anyOf": [
              {
                "$ref": "#/definitions/WhatIfConfigFileTemplateProperty"
              },
              {
                "$ref": "#/definitions/WhatIfBooleanTemplateProperty"
              },
              {
                "$ref": "#/definitions/WhatIfIntTemplateProperty"
              },
              {
                "$ref": "#/definitions/WhatIfDoubleTemplateProperty"
              },
              {
                "$ref": "#/definitions/WhatIfStringTemplateProperty"
              },
              {
                "$ref": "#/definitions/WhatIfDateTimeTemplateProperty"
              },
              {
                "$ref": "#/definitions/WhatIfTemplateIdTemplateProperty"
              },
              {
                "$ref": "#/definitions/WhatIfEnumTemplateProperty"
              },
              {
                "$ref": "#/definitions/WhatIfMultiProperty"
              }
            ]
          }
        },
        "defaultSingleRunWhatIfSetting": {
          "type": "boolean",
          "description": "Determines if the what-if is a single run what-if by default"
        },
        "overrulableSingleRunWhatIf": {
          "type": "boolean",
          "description": "Determines if the default setting above can be overruled. Can a what-if which is by default not a single what-if be a single run what-if?"
        }
      }
    },
    "WhatIfEnumTemplateProperty": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "defaultValue",
        "value"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the property"
        },
        "name": {
          "type": "string",
          "description": "The name of the property"
        },
        "type": {
          "type": "string",
          "description": "The type of the property"
        },
        "defaultValue": {
          "type": "integer",
          "description": "The default value of the property"
        },
        "value": {
          "description": "value of the enum",
          "type": "object",
          "required": [
            "code",
            "label"
          ],
          "properties": {
            "code": {
              "type": "string",
              "description": "the code of the value"
            },
            "label": {
              "type": "string",
              "description": "The label of the value"
            }
          }
        }
      }
    },
    "WhatIfIntTemplateProperty": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "defaultValue"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the property"
        },
        "name": {
          "type": "string",
          "description": "The name of the property"
        },
        "type": {
          "type": "string",
          "description": "The type of the property"
        },
        "defaultValue": {
          "type": "integer",
          "description": "The default value of the property"
        }
      }
    },
    "WhatIfBooleanTemplateProperty": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "defaultValue"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the property"
        },
        "name": {
          "type": "string",
          "description": "The name of the property"
        },
        "type": {
          "const": "boolean",
          "description": "Boolean property"
        },
        "defaultValue": {
          "type": "boolean",
          "description": "The default value of the property"
        }
      }
    },
    "WhatIfConfigFileTemplateProperty": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "configFileType"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the property"
        },
        "name": {
          "type": "string",
          "description": "The name of the property"
        },
        "type": {
          "type": "string",
          "description": "The type of the property"
        },
        "configFileType": {
          "enum": [
            "cold state",
            "module dataset",
            "module parameter"
          ],
          "description": "The config file type"
        },
        "default": {
          "type": "string",
          "description": "The default config file"
        },
        "pattern": {
          "type": "string",
          "description": "The configured pattern"
        }
      }
    },
    "WhatIfTemplateIdTemplateProperty": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "templateId"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the property"
        },
        "name": {
          "type": "string",
          "description": "The name of the property"
        },
        "type": {
          "type": "string",
          "description": "The type of the property"
        },
        "templateId": {
          "type": "string",
          "description": "The template id of the referenced whatif"
        }
      }
    },
    "WhatIfDateTimeTemplateProperty": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "defaultValue"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the property"
        },
        "name": {
          "type": "string",
          "description": "The name of the property"
        },
        "type": {
          "type": "string",
          "description": "The type of the property"
        },
        "defaultValue": {
          "type": "string",
          "description": "The default value of the property"
        },
        "relativePeriod": {
          "title": "object",
          "$ref": "#/definitions/RelativePeriod"
        },
        "cardinalTimeStep": {
          "title": "object",
          "$ref": "#/definitions/CardinalTimeStep"
        }
      }
    },
    "CardinalTimeStep": {
      "type": "object",
      "description": "Cardinal time step",
      "required": [
        "timeZone",
        "unit",
        "multiplier"
      ],
      "title": "CardinalTimeStep",
      "additionalProperties": false,
      "properties": {
        "timeZone": {
          "description": "Timezone of the time step",
          "type": "string"
        },
        "unit": {
          "description": "Unit of the view period",
          "type": "string",
          "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "week"
          ]
        },
        "multiplier": {
          "description": "multiplier of the unit of the time step",
          "type": "string"
        }
      }
    },
    "RelativePeriod": {
      "type": "object",
      "description": "View Period",
      "required": [
        "unit"
      ],
      "title": "RelativePeriod",
      "additionalProperties": false,
      "properties": {
        "unit": {
          "description": "Unit of the view period",
          "type": "string",
          "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "week"
          ]
        },
        "start": {
          "description": "Start of the view period. Optional.",
          "type": "string"
        },
        "end": {
          "description": "End of the view period. Optional.",
          "type": "string"
        }
      }
    },
    "WhatIfStringTemplateProperty": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "defaultValue"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the property"
        },
        "name": {
          "type": "string",
          "description": "The name of the property"
        },
        "type": {
          "type": "string",
          "description": "The type of the property"
        },
        "defaultValue": {
          "type": "string",
          "description": "The default value of the property"
        }
      }
    },
    "WhatIfMultiProperty": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "type",
        "selectionOptions"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "const": "multiProperty"
        },
        "name": {
          "type": "string"
        },
        "defaultValue": {
          "type": "integer"
        },
        "selectionOptions": {
          "type": "array",
          "description": "WhatIfMultiPropertySelectionOptions",
          "items": {
            "$ref": "#/definitions/MultiPropertySelectionOptions"
          }
        }
      }
    },
    "MultiPropertySelectionOptions": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "code",
        "label"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "label": {
          "type": "string"
        }
      }
    },
    "WhatIfDoubleTemplateProperty": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "defaultValue"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "the id of the property"
        },
        "name": {
          "type": "string",
          "description": "The name of the property"
        },
        "type": {
          "type": "string",
          "description": "The type of the property"
        },
        "defaultValue": {
          "type": "number",
          "description": "The default value of the property"
        },
        "minValue": {
          "type": "number",
          "description": "The min value of the property"
        },
        "maxValue": {
          "type": "number",
          "description": "The max value of the property"
        }
      }
    }
  }
}
