{
  "$schema": "http://json-schema.org/draft-07/schema",
  "allOf": [
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "text"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "text": false
        }
      }
    },
    {
      "if": {
        "not": {
          "anyOf": [
            {
              "$ref": "../field-types/inputs.json"
            },
            {
              "properties": {
                "type": {
                  "enum": ["button", "iframe"]
                }
              },
              "required": ["type"]
            },
            {
              "$ref": "../field-types/containers.json"
            },
            {
              "$ref": "../field-types/presentation-components.json"
            }
          ]
        }
      },
      "then": {
        "properties": {
          "label": false
        }
      }
    },
    {
      "if": {
        "not": {
          "$ref": "../field-types/inputs.json"
        }
      },
      "then": {
        "properties": {
          "description": false,
          "disabled": false,
          "readonly": false,
          "validate": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "button"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "action": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "image"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "source": false,
          "alt": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "datetime"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "subtype": false,
          "dateLabel": false,
          "timeLabel": false,
          "use24h": false,
          "timeSerializingFormat": false,
          "timeInterval": false,
          "disallowPassedDates": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "number"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "increment": false,
          "decimalDigits": false,
          "serializeToString": false,
          "validate": {
            "properties": {
              "min": false,
              "max": false
            }
          }
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "select"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "searchable": false
        }
      }
    },
    {
      "if": {
        "not": {
          "$ref": "../field-types/multi-inputs.json"
        }
      },
      "then": {
        "properties": {
          "values": false,
          "valuesKey": false,
          "valuesExpression": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "textfield"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "validate": {
            "properties": {
              "validationType": false,
              "pattern": false
            }
          }
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "enum": ["textfield", "textarea"]
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "validate": {
            "properties": {
              "minLength": false,
              "maxLength": false
            }
          }
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "enum": ["textfield", "number"]
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "appearance": {
            "properties": {
              "prefixAdorner": false,
              "suffixAdorner": false
            }
          }
        }
      }
    },
    {
      "if": {
        "anyOf": [
          {
            "not": {
              "$ref": "../field-types/inputs.json"
            }
          },
          {
            "allOf": [
              {
                "$ref": "../field-types/multi-inputs.json"
              },
              {
                "properties": {
                  "valuesKey": {
                    "type": "string"
                  }
                },
                "required": ["valuesKey"]
              }
            ]
          }
        ]
      },
      "then": {
        "properties": {
          "defaultValue": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "enum": ["spacer", "iframe"]
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "height": false
        }
      }
    },
    {
      "if": {
        "not": {
          "$ref": "../field-types/containers.json"
        }
      },
      "then": {
        "properties": {
          "path": false,
          "showOutline": false,
          "verticalAlignment": false,
          "components": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "dynamiclist"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "isRepeating": false,
          "defaultRepetitions": false,
          "allowAddRemove": false,
          "disableCollapse": false,
          "nonCollapsedItems": false
        }
      }
    },
    {
      "if": {
        "not": {
          "$ref": "../field-types/inputs.json"
        }
      },
      "then": {
        "properties": {
          "key": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "table"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "columns": false,
          "columnsExpression": false,
          "rowCount": false
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "table"
          }
        },
        "required": ["type"]
      },
      "then": {
        "oneOf": [
          {
            "properties": {
              "columns": true,
              "rowCount": true,
              "columnsExpression": false,
              "dataSource": true
            },
            "errorMessage": "Invalid combination of properties. 'columns' and 'columnsExpression' should not exist together."
          },
          {
            "properties": {
              "columns": false,
              "rowCount": true,
              "columnsExpression": true,
              "dataSource": true
            },
            "errorMessage": "Invalid combination of properties. 'columns' and 'columnsExpression' not should exist together."
          }
        ]
      }
    },
    {
      "if": {
        "not": {
          "$ref": "../field-types/presentation-components.json"
        }
      },
      "then": {
        "properties": {
          "dataSource": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "html"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "content": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "filepicker"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "accept": false,
          "multiple": false
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "filepicker"
          }
        },
        "required": ["type"]
      },
      "then": {
        "properties": {
          "description": false
        }
      }
    },
    {
      "if": {
        "not": {
          "properties": {
            "type": {
              "const": "documentPreview"
            }
          },
          "required": ["type"]
        }
      },
      "then": {
        "properties": {
          "endpointKey": false,
          "maxHeight": false
        }
      }
    }
  ]
}
