{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://anterotrail.com/schemas/estimate-v1.schema.json",
  "title": "estimate-v1",
  "type": "object",
  "required": [
    "schema_version",
    "claim",
    "sections"
  ],
  "additionalProperties": false,
  "properties": {
    "schema_version": {
      "type": "string",
      "enum": [
        "1.0"
      ]
    },
    "claim": {
      "type": "object",
      "required": [
        "estimate_name"
      ],
      "additionalProperties": false,
      "properties": {
        "estimate_name": {
          "type": "string"
        },
        "claim_number": {
          "type": "string"
        },
        "policy_number": {
          "type": "string"
        },
        "insured_name": {
          "type": "string"
        },
        "property_address": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "street": {
              "type": "string"
            },
            "city": {
              "type": "string"
            },
            "state": {
              "type": "string"
            },
            "zip": {
              "type": "string"
            }
          }
        },
        "date_of_loss": {
          "type": "string"
        },
        "type_of_loss": {
          "type": "string"
        },
        "price_list": {
          "type": "string"
        }
      }
    },
    "sections": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name",
          "line_items"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "path": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dimensions": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "floor_sf": {
                "type": "number"
              },
              "ceiling_sf": {
                "type": "number"
              },
              "wall_sf": {
                "type": "number"
              },
              "wall_and_ceiling_sf": {
                "type": "number"
              },
              "floor_perimeter_lf": {
                "type": "number"
              },
              "ceiling_perimeter_lf": {
                "type": "number"
              },
              "roof_surface_sf": {
                "type": "number"
              },
              "roof_squares": {
                "type": "number"
              },
              "height_ft": {
                "type": "number"
              },
              "length_ft": {
                "type": "number"
              },
              "width_ft": {
                "type": "number"
              }
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "text"
              ],
              "additionalProperties": false,
              "properties": {
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "line_items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "description",
                "quantity",
                "unit"
              ],
              "additionalProperties": false,
              "properties": {
                "cat": {
                  "type": "string"
                },
                "sel": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "number"
                },
                "unit": {
                  "type": "string"
                },
                "activity": {
                  "type": "string"
                },
                "unit_price": {
                  "type": "string",
                  "pattern": "^-?\\d+\\.\\d{2}$"
                },
                "tax": {
                  "type": "string",
                  "pattern": "^-?\\d+\\.\\d{2}$"
                },
                "rcv": {
                  "type": "string",
                  "pattern": "^-?\\d+\\.\\d{2}$"
                },
                "notes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "text"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "text": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "totals": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "rcv": {
          "type": "string",
          "pattern": "^-?\\d+\\.\\d{2}$"
        }
      }
    }
  }
}
