{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/calculate-co-nz/json-schema/calculate-co-nz-rates-response-schema.json",
  "title": "RatesResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/calculate-co-nz-reference-data-api-openapi.yml#/components/schemas/RatesResponse",
  "properties": {
    "dataset": {
      "type": "string",
      "title": "Dataset",
      "description": "Name of the dataset."
    },
    "publisher": {
      "type": "string",
      "title": "Publisher",
      "description": "Who maintains it."
    },
    "count": {
      "type": "integer",
      "title": "Count",
      "description": "Rates returned by this request."
    },
    "total": {
      "type": "integer",
      "title": "Total",
      "description": "Rates in the dataset overall."
    },
    "verified_count": {
      "type": "integer",
      "title": "Verified Count",
      "description": "How many carry a verification date."
    },
    "register_updated": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Register Updated",
      "description": "When the register was last touched."
    },
    "correctness_note": {
      "type": "string",
      "title": "Correctness Note",
      "description": "How these figures are checked."
    },
    "rates": {
      "items": {
        "$ref": "#/$defs/RateRecord"
      },
      "type": "array",
      "title": "Rates",
      "description": "The rates themselves."
    }
  },
  "type": "object",
  "required": [
    "dataset",
    "publisher",
    "count",
    "total",
    "verified_count",
    "correctness_note",
    "rates"
  ],
  "$defs": {
    "RateRecord": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Stable identifier. Safe to store and to key on."
        },
        "label": {
          "type": "string",
          "title": "Label",
          "description": "What the figure is, in words."
        },
        "value": {
          "type": "string",
          "title": "Value",
          "description": "The current value, as published. A string so 1.75 and 0.0175 are never confused by a float."
        },
        "effective_from": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Effective From",
          "description": "ISO date the value took effect, where the source states one."
        },
        "source": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source",
          "description": "Where it was read from. A URL for anything verified against an issuing body."
        },
        "verified_on": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Verified On",
          "description": "ISO date this figure was last checked against the issuing body. NULL means recorded but not yet verified, and is deliberately visible rather than hidden."
        },
        "review_cycle": {
          "type": "string",
          "title": "Review Cycle",
          "description": "When it next changes: annual-1-april, budget-may, periodic, or on-legislative-change. This is the field to filter on if you want to know what to re-check and when."
        },
        "previous_values": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Previous Values",
          "description": "Prior values, most recent first. Undated for now."
        },
        "history_note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "History Note",
          "description": "The limits of previous_values."
        },
        "note": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Note",
          "description": "Anything a consumer needs to know about this figure."
        }
      },
      "type": "object",
      "required": [
        "id",
        "label",
        "value",
        "review_cycle"
      ],
      "title": "RateRecord"
    }
  }
}