{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$defs": {
    "commonProperties": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "pattern": "(?i)^[a-z_][a-z_0-9]*$",
          "maxLength": 64
        },
        "label": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "defaultValue": {
          "type": ["string", "number", "boolean"]
        }
      },
      "required": [
        "name"
      ]
    },
    "commonPropertiesBool": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "pattern": "(?i)^[a-z_][a-z_0-9]*$"
        },
        "label": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "defaultValue": {
          "type": "boolean"
        }
      },
      "required": [
        "name"
      ]
    }
  },
  "type": "object",
  "properties": {
    "body": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "required": [
          "type",
          "attributes"
        ],
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "textBlock"
              },
              "attributes": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["description"]
              }
            },
            "required": [
              "type",
              "attributes"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "enum": ["input", "inputWithFileBtn", "inputWithFolderBtn", "textarea", "passwordBox"]
              },
              "attributes": {
                "$ref": "#/$defs/commonProperties"
              }
            },
            "required": [
              "type",
              "attributes"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "dropdown"
              },
              "attributes": {
                "$ref": "#/$defs/commonProperties",
                "properties": {
                  "options": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": {
                      "type": ["string", "number", "boolean"]
                    }
                  }
                },
                "required": ["name", "options"]
              }
            },
            "required": [
              "type",
              "attributes"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "checkbox"
              },
              "attributes": {
                "$ref": "#/$defs/commonPropertiesBool"
              }
            },
            "required": [
              "type",
              "attributes"
            ]
          }
        ]
      }
    }
  },
  "required": [
    "body"
  ]
}
