{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dataquoll-io/json-schema/dataquoll-io-declaration-list-schema.json",
  "title": "DeclarationList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dataquoll-io-declarations-api-openapi.yml#/components/schemas/DeclarationList",
  "type": "object",
  "properties": {
    "declarations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DeclarationListItem"
      }
    },
    "dataLastUpdated": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "stale": {
      "type": "boolean"
    },
    "disclaimer": {
      "type": "string"
    },
    "meta": {
      "type": "object",
      "properties": {
        "generatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "count": {
          "type": "integer",
          "description": "Records on this page."
        }
      }
    },
    "links": {
      "type": "object",
      "properties": {
        "next": {
          "type": [
            "string",
            "null"
          ],
          "description": "The next page: this request's path and query with only cursor changed, so every filter and the limit carry over. Null when there is no next page."
        }
      }
    },
    "attribution": {
      "type": "string"
    }
  },
  "$defs": {
    "DeclarationListItem": {
      "allOf": [
        {
          "$ref": "#/$defs/DeclarationRecord"
        },
        {
          "type": "object",
          "properties": {
            "lgaCount": {
              "type": "integer"
            }
          }
        }
      ]
    },
    "DeclarationRecord": {
      "type": "object",
      "properties": {
        "agrn": {
          "type": [
            "string",
            "null"
          ]
        },
        "title": {
          "type": "string"
        },
        "instrumentType": {
          "type": "string",
          "enum": [
            "state_natural_disaster_declaration",
            "drfa_activation_agrn",
            "state_of_disaster_emergency_powers"
          ]
        },
        "jurisdiction": {
          "type": "string"
        },
        "disasterTypes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "startDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "expired",
            "unknown"
          ]
        },
        "source": {
          "type": "string",
          "description": "Display name of the highest-precedence reporting source"
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Every government source reporting this AGRN+instrument for this LGA. Multiple entries = multiple sources corroborate it."
        },
        "sourceUrl": {
          "type": "string"
        },
        "sourcePublishedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "scope": {
          "type": "string",
          "enum": [
            "part_not_stated"
          ],
          "description": "Present only when we hold this record against a whole ABS catch-all area (for example Unincorporated SA) because the source's name for the area matches no part we can place. It still counts toward the status, except that a declaration held this way reads uncertain, never declared."
        },
        "publishedFor": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "With scope only: the sources' own names for the area, verbatim (for example \"Unincorporated South Australia (Gawler Ranges)\"), leaving out any that is just the ABS name. Omitted when none remain."
        }
      }
    }
  }
}