{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "$id": "https://example.com/product.schema.json",
  "title": "Form",
  "description": "A form",
  "type": "object",
  "required": ["form_type", "start_year", "end_year", "sections"],
  "properties": {
    "form_type": {
      "description": "",
      "type": "string"
    },
    "start_year": {
      "description": "",
      "type": "integer"
    },
    "end_year": {
      "description": "",
      "type": "integer"
    },
    "sections": {
      "type": "object",
      "patternProperties": {
        "[a-z_]+": {
          "description": "Section Name",
          "type": "object",
          "properties": {
            "label": {
              "description": "",
              "type": "string"
            },
            "subsections": {
              "type": "object",
              "patternProperties": {
                "[a-z_]+": {
                  "description": "SubSection Name",
                  "type": "object",
                  "required": ["label"],
                  "properties": {
                    "label": {
                      "description": "",
                      "type": "string"
                    },
                    "pages": {
                      "type": "object",
                      "patternProperties": {
                        "^(?!(depends_on))[a-z_]+$": {
                          "description": "Page Name",
                          "type": "object",
                          "required": ["header", "questions"],
                          "properties": {
                            "header": {
                              "description": "",
                              "type": "string"
                            },
                            "description": {
                              "description": "",
                              "type": "string"
                            },
                            "questions": {
                              "type": "object",
                              "patternProperties": {
                                "[a-z_]+": {
                                  "description": "Question Name",
                                  "type": "object",
                                  "required": ["header", "type"],
                                  "properties": {
                                    "header": {
                                      "description": "",
                                      "type": "string"
                                    },
                                    "type": {
                                      "description": "",
                                      "type": "string"
                                    },
                                    "check_answer_label": {
                                      "description": "",
                                      "type": "string",
                                      "optional": "true"
                                    }
                                  },
                                  "additionalProperties": {
                                    "hint_text": {
                                      "optional": "true",
                                      "description": "",
                                      "type": "string"
                                    },
                                    "answer_options": {
                                      "optional": "true",
                                      "description": "",
                                      "type": "object"
                                    },
                                    "check_answer_label": {
                                      "description": "",
                                      "type": "string"
                                    },
                                    "conditional_for": {
                                      "description": "",
                                      "type": "object"
                                    },
                                    "inferred_answers": {
                                      "description": "fields that get inferred based on the value of the current field",
                                      "type": "object"
                                    },
                                    "inferred_check_answers_value": {
                                      "description": "value that gets displayed in the check answers for this field if the given condition is met",
                                      "type": "object",
                                      "properties": {
                                        "condition": {
                                          "description": "",
                                          "type": "object"
                                        },
                                        "value": {
                                          "description": "",
                                          "type": "object"
                                        }
                                      }
                                    }
                                  },
                                  "minProperties": 1
                                }
                              }
                            }
                          },
                          "additionalProperties": {
                            "depends_on": {
                              "description": "",
                              "type": "object"
                            }
                          },
                          "minProperties": 1
                        }
                      }
                    }
                  },
                  "minProperties": 1
                }
              }
            }
          },
          "minProperties": 2
        }
      },
      "minProperties": 1
    }
  }
}