{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dataquoll-io/json-schema/dataquoll-io-gauge-schema.json",
  "title": "Gauge",
  "description": "A gauge station with its latest reading. Water-level readings are metres relative to the gauge's local datum, not sea level; rainfall readings are incremental millimetres. floodClass, thresholds and datum are present only on water-level gauges.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dataquoll-io-openapi.json#/components/schemas/Gauge",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "river": {
      "type": [
        "string",
        "null"
      ]
    },
    "state": {
      "type": "string"
    },
    "agency": {
      "type": [
        "string",
        "null"
      ]
    },
    "source": {
      "type": "string"
    },
    "variable": {
      "type": "string",
      "enum": [
        "water_level",
        "rainfall"
      ],
      "description": "The measured variable. Rainfall gauges carry no floodClass, thresholds or datum."
    },
    "awrcStationNo": {
      "type": [
        "string",
        "null"
      ]
    },
    "coordinates": {
      "type": "object",
      "properties": {
        "lat": {
          "type": "number"
        },
        "lng": {
          "type": "number"
        }
      }
    },
    "lga": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "latest": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "value": {
          "type": "number"
        },
        "observedAt": {
          "type": "string",
          "format": "date-time"
        },
        "quality": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "readingStatus": {
      "type": "string",
      "enum": [
        "live",
        "stale"
      ]
    },
    "unit": {
      "type": "string",
      "description": "Present on rainfall gauges (always 'mm'). Water-level gauges carry their unit inside thresholds.unit."
    },
    "floodClass": {
      "type": "string",
      "enum": [
        "below_minor",
        "minor",
        "moderate",
        "major",
        "unclassified"
      ],
      "description": "Water-level gauges only. Derived at read time from the latest reading vs the published BoM thresholds; never stored as judgement."
    },
    "thresholds": {
      "type": "object",
      "description": "Water-level gauges only.",
      "properties": {
        "minor": {
          "type": [
            "number",
            "null"
          ]
        },
        "moderate": {
          "type": [
            "number",
            "null"
          ]
        },
        "major": {
          "type": [
            "number",
            "null"
          ]
        },
        "unit": {
          "type": "string"
        },
        "source": {
          "type": [
            "string",
            "null"
          ]
        },
        "version": {
          "type": [
            "string",
            "null"
          ]
        },
        "fetchedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "datum": {
      "type": [
        "object",
        "null"
      ],
      "description": "Water-level gauges only.",
      "properties": {
        "gaugeZeroM": {
          "type": [
            "number",
            "null"
          ]
        },
        "datum": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}