{
  "type": "array",
  "description": "List of the template's properties.",
  "allOf": [
    { "$ref": "examples.json#/properties" }
  ],
  "items": {
    "type": "object",
    "default": {},
    "allOf": [
      {
        "if": {
          "properties": {
            "type": {
              "const": "Dropdown"
            }
          },
          "required": [
            "type"
          ]
        },
        "then": {
          "required": [
            "choices"
          ]
        }
      },
      {
        "if": {
          "properties": {
            "type": {
              "not": {
                "const": "Number"
              }
            }
          },
          "required": [
            "type"
          ]
        },
        "then": {
          "properties": {
            "value": {
              "type": [
                "string",
                "boolean"
              ]
            }
          }
        }
      },
      {
        "if": {
          "oneOf": [
            {
              "properties": {
                "type": {
                  "enum": [
                    "String",
                    "Text"
                  ]
                }
              },
              "required": [
                "type"
              ]
            },
            {
              "not": {
                "required": [
                  "type"
                ]
              }
            }
          ]
        },
        "then": {
          "properties": {
            "placeholder": {
              "type": "string",
              "description": "Placeholder text shown in the property input field when it is empty. Can be used to show example input."
            }
          }
        },
        "else": {
          "not": {
            "required": [
              "placeholder"
            ]
          }
        }
      }
    ],
    "properties": {
      "value": {
        "$id": "#/properties/property/value",
        "type": [
          "string",
          "number",
          "boolean"
        ],
        "description": "Default value to be used if the user does not provide a value or if the type is Hidden."
      },
      "description": {
        "$id": "#/properties/property/description",
        "type": "string",
        "description": "Hint text shown below the property input field."
      },
      "label": {
        "$id": "#/properties/property/label",
        "type": "string",
        "description": "Label text shown above the property input field."
      },
      "type": {
        "$id": "#/properties/property/type",
        "type": "string",
        "description": "The type of a control field."
      },
      "editable": {
        "$id": "#/properties/property/editable",
        "type": "boolean",
        "description": "Defines whether users can edit the property in the properties panel. By default, all non-hidden properties are editable."
      },
      "choices": {
        "$id": "#/properties/property/choices",
        "type": "array",
        "description": "List of choices for a dropdown field.",
        "default": [],
        "items": {
          "$id": "#/properties/property/choices/item",
          "type": "object",
          "default": {},
          "properties": {
            "name": {
              "$id": "#/properties/property/choices/item/name",
              "type": "string",
              "description": "Display name for a choice in a dropdown field. Shown to the user."
            },
            "value": {
              "$id": "#/properties/property/choices/item/value",
              "type": "string",
              "description": "Value for a choice in a dropdown field. Stored in the XML."
            },
          },
          "required": [
            "value",
            "name"
          ]
        }
      },
      "constraints": {
        "$id": "#/properties/property/constraints",
        "type": "object",
        "description": "Object that contains rules to validate user input to the template.",
        "allOf": [
          { "$ref": "examples.json#/constraints" }
        ],
        "properties": {
          "notEmpty": {
            "$id": "#/properties/property/constraints/notEmpty",
            "type": "boolean",
            "description": "The control field must not be empty."
          },
          "minLength": {
            "$id": "#/properties/property/constraints/minLength",
            "type": "number",
            "description": "The minimal length of a control field value."
          },
          "maxLength": {
            "$id": "#/properties/property/constraints/maxLength",
            "type": "number",
            "description": "The maximal length for a control field value."
          },
          "pattern": {
            "$id": "#/properties/property/constraints/pattern",
            "description": "String or object that defines a regular expression that the user's input must match.",
            "oneOf": [
              {
                "type": "object",
                "default": {},
                "properties": {
                  "value": {
                    "$id": "#/properties/property/constraints/pattern/value",
                    "type": "string",
                    "description": "The value of the regular expression."
                  },
                  "message": {
                    "$id": "#/properties/property/constraints/pattern/message",
                    "type": "string",
                    "description": "Custom error message to show when the user's input does not match the regular expression."
                  }
                }
              },
              {
                "type": "string"
              }
            ]
          }
        }
      },
      "group": {
        "$id": "#/properties/property/group",
        "type": "string",
        "description": "Group in the properties panel that the property belongs to."
      }
    }
  }
}