{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/eliq/main/json-schema/eliq-budget-history-schema.json",
  "title": "BudgetHistory",
  "description": "Past budget periods for a location as aligned time series. Each index in `limit` and `consumption` corresponds to one period between `from` and `to` at `resolution`.",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eliq-budgets-api-openapi.yml#/components/schemas/BudgetHistory",
  "type": "object",
  "properties": {
    "fuel": {
      "type": "string",
      "description": "Fuel the history is for.",
      "enum": [
        "elec",
        "gas",
        "district_heating"
      ]
    },
    "unit": {
      "type": "string",
      "description": "Unit the history is for.",
      "enum": [
        "energy",
        "cost"
      ]
    },
    "resolution": {
      "type": "string",
      "description": "Resolution of the history periods.",
      "enum": [
        "week",
        "month"
      ]
    },
    "from": {
      "type": "string",
      "description": "Start of the first period (inclusive).",
      "format": "date-time"
    },
    "to": {
      "type": "string",
      "description": "End of the last period (exclusive).",
      "format": "date-time"
    },
    "limit": {
      "type": "array",
      "description": "Budget limit for each period. Null for periods where no budget was set.",
      "items": {
        "type": [
          "number",
          "null"
        ]
      }
    },
    "consumption": {
      "type": "array",
      "description": "Actual consumption for each period. Null for periods with no data.",
      "items": {
        "type": [
          "number",
          "null"
        ]
      }
    }
  },
  "required": [
    "fuel",
    "unit",
    "resolution",
    "from",
    "to",
    "limit",
    "consumption"
  ]
}