{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "formData",
  "description": "Schema definition for formData",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "pattern": "\\.json$"
    },
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "stages": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "children": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "id",
          "children"
        ],
        "additionalProperties": false
      },
      "propertyNames": {
        "format": "uuid"
      },
      "description": "Droppable zones for rows, columns and fields"
    },
    "rows": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "children": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "className": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "config": {
            "type": "object",
            "properties": {
              "fieldset": {
                "type": "boolean"
              },
              "legend": {
                "type": "string"
              },
              "inputGroup": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "children"
        ],
        "additionalProperties": false
      },
      "propertyNames": {
        "format": "uuid"
      },
      "description": "Droppable zones for columns and fields"
    },
    "columns": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "children": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "className": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "config": {
            "type": "object",
            "properties": {
              "width": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "children"
        ],
        "additionalProperties": false
      },
      "propertyNames": {
        "format": "uuid"
      },
      "description": "Droppable zones for fields"
    },
    "fields": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "tag": {
            "type": "string"
          },
          "attrs": {
            "type": "object",
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "label": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "selected": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "label",
                      "value"
                    ],
                    "additionalProperties": false
                  }
                }
              ]
            }
          },
          "config": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "hideLabel": {
                "type": "boolean"
              },
              "editableContent": {
                "type": "boolean"
              }
            },
            "additionalProperties": {}
          },
          "meta": {
            "type": "object",
            "properties": {
              "group": {
                "type": "string"
              },
              "icon": {
                "type": "string"
              },
              "id": {
                "type": "string"
              }
            },
            "additionalProperties": false
          },
          "content": {},
          "action": {
            "type": "object",
            "properties": {},
            "additionalProperties": false
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "selected": {
                  "type": "boolean"
                },
                "checked": {
                  "type": "boolean"
                },
                "type": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      },
                      "selected": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "type",
                      "label"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "label"
              ],
              "additionalProperties": {}
            }
          },
          "conditions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "if": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string"
                      },
                      "sourceProperty": {
                        "type": "string"
                      },
                      "comparison": {
                        "type": "string"
                      },
                      "target": {
                        "type": "string"
                      },
                      "targetProperty": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "then": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "target": {
                        "type": "string"
                      },
                      "targetProperty": {
                        "type": "string"
                      },
                      "assignment": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              },
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "tag"
        ],
        "additionalProperties": false
      },
      "propertyNames": {
        "format": "uuid"
      },
      "description": "Field and Element definitions"
    }
  },
  "required": [
    "$schema",
    "id",
    "stages",
    "rows",
    "columns",
    "fields"
  ],
  "additionalProperties": false
}