{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dataquoll-io/json-schema/dataquoll-io-hazard-history-result-schema.json",
  "title": "HazardHistoryResult",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dataquoll-io-openapi.json#/components/schemas/HazardHistoryResult",
  "type": "object",
  "properties": {
    "location": {
      "type": "object",
      "description": "The ABS local government area containing the point. All fields are null when the point lies outside every Australian LGA.",
      "properties": {
        "lgaCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "lgaName": {
          "type": [
            "string",
            "null"
          ]
        },
        "stateCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "area": {
          "type": "object",
          "description": "Present only inside an ABS catch-all code whose parts we hold boundaries for (NSW and Victoria): the part the point is in. Declarations placed in another part are left out.",
          "properties": {
            "code": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          }
        }
      }
    },
    "radiusKm": {
      "type": "number"
    },
    "declared": {
      "type": "object",
      "description": "Disaster declarations covering the local government area, counted once per AGRN. Declared status needs declarations access (the Organisation licence): without it this object is `{ included: false, reason }` and carries no record.",
      "properties": {
        "included": {
          "type": "boolean",
          "description": "Present and false only when the key's account has no declarations access; the lane then carries only `reason`."
        },
        "reason": {
          "type": "string",
          "description": "Where declared status is available, when `included` is false."
        },
        "distinctCount": {
          "type": "integer",
          "description": "Number of distinct AGRNs, not a row count. One event recorded by three authorities counts once."
        },
        "earliest": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "latest": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "records": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "agrn": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "startDate": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "endDate": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "endDatePublished": {
                "type": "boolean",
                "description": "Whether the authority published an end date. False with a null endDate means no end has been published, which does NOT mean the declaration is in force."
              },
              "jurisdiction": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sources": {
                "type": "array",
                "description": "Every source that recorded this AGRN, so a single row is traceable to the several authorities behind it.",
                "items": {
                  "type": "string"
                }
              },
              "scope": {
                "type": "string",
                "enum": [
                  "part_not_stated"
                ],
                "description": "Present only when we hold the declaration against a whole ABS catch-all area because the source's name for the area matches no part we can place."
              }
            }
          }
        },
        "sourceUrls": {
          "type": "object",
          "description": "Official source URL per AGRN, where known. Omitted when none are.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "observed": {
      "type": "object",
      "description": "What official sources recorded within the radius, from both lanes. byType, byPrecision, earliest, latest and records cover the historical archive and the live-era incident history together; archiveTotal and liveTotal split the count by lane.",
      "properties": {
        "archiveTotal": {
          "type": "integer",
          "description": "Records from the historical archive."
        },
        "liveTotal": {
          "type": "integer",
          "description": "Records from the live-era incident history (2026-04-08 onward)."
        },
        "earliest": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "The earliest dated record's date: the first day of its stated period when that record is dated only to a period (see earliestDatePrecision)."
        },
        "latest": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "The latest dated record's date, the first day of its stated period when it has one (see latestDatePrecision)."
        },
        "earliestDatePrecision": {
          "type": "string",
          "enum": [
            "month",
            "season",
            "financial_year",
            "year",
            "period"
          ],
          "description": "Present only when the earliest record is dated only to a period, not a day."
        },
        "latestDatePrecision": {
          "type": "string",
          "enum": [
            "month",
            "season",
            "financial_year",
            "year",
            "period"
          ],
          "description": "Present only when the latest record is dated only to a period, not a day."
        },
        "undatedCount": {
          "type": "integer",
          "description": "Records that carry no date. Present in the counts, flagged dated=false, never given an invented date."
        },
        "byType": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "eventType": {
                "type": "string"
              },
              "eventCategory": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "count": {
                "type": "integer"
              },
              "earliest": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "latest": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "undated": {
                "type": "integer",
                "description": "Records of this type that carry no date (counted, never placed in earliest or latest)."
              },
              "earliestDatePrecision": {
                "type": "string",
                "enum": [
                  "month",
                  "season",
                  "financial_year",
                  "year",
                  "period"
                ],
                "description": "As observed.earliestDatePrecision, for this type."
              },
              "latestDatePrecision": {
                "type": "string",
                "enum": [
                  "month",
                  "season",
                  "financial_year",
                  "year",
                  "period"
                ],
                "description": "As observed.latestDatePrecision, for this type."
              }
            }
          }
        },
        "byPrecision": {
          "type": "array",
          "description": "How the matched records were located. Postcode-precision records sit at a postcode centroid, not at the event.",
          "items": {
            "type": "object",
            "properties": {
              "precision": {
                "type": "string"
              },
              "geometryType": {
                "type": "string"
              },
              "count": {
                "type": "integer"
              }
            }
          }
        },
        "records": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "eventType": {
                "type": "string"
              },
              "eventCategory": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "onDate": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "dated": {
                "type": "boolean"
              },
              "datePrecision": {
                "type": "string",
                "enum": [
                  "month",
                  "season",
                  "financial_year",
                  "year",
                  "period"
                ],
                "description": "Present only when the source stated less than a day: onDate is then the first day of the stated period (a month, a burn or fire season, a financial year, a calendar year, or another stated span) and datePeriodEnd its last. Neither is a stated day."
              },
              "datePeriodEnd": {
                "type": "string",
                "format": "date",
                "description": "The last day of the stated period. Present with datePrecision."
              },
              "precision": {
                "type": "string"
              },
              "geometryType": {
                "type": "string"
              },
              "sourceAgency": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sourceFeedId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lane": {
                "type": "string",
                "enum": [
                  "archive",
                  "live"
                ],
                "description": "archive = the historical archive; live = the live-era incident history (2026-04-08 onward)."
              }
            }
          }
        }
      }
    },
    "gauge": {
      "type": [
        "object",
        "null"
      ],
      "description": "Nearest active river gauge, for context. Not a flood assessment.",
      "properties": {
        "name": {
          "type": "string"
        },
        "jurisdiction": {
          "type": [
            "string",
            "null"
          ]
        },
        "distanceM": {
          "type": "integer"
        }
      }
    },
    "coverage": {
      "type": "array",
      "description": "The measured limits of this answer. Rides on every response.",
      "items": {
        "type": "string"
      }
    },
    "disclaimer": {
      "type": "string"
    }
  }
}