{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://qz.energy/data/schemas/release-history.schema.json",
  "title": "qz.energy public release history",
  "type": "object",
  "required": ["schema_version", "product_id", "current_release_id", "releases", "changes"],
  "properties": {
    "schema_version": {"type": "string"},
    "product_id": {"const": "qz-energy"},
    "history_scope": {"type": "string"},
    "current_release_id": {"type": "string"},
    "releases": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["release_id", "published_at", "change_ids", "closeout"],
        "properties": {
          "release_id": {"type": "string"},
          "published_at": {"type": "string", "format": "date-time"},
          "data_as_of": {"type": ["string", "null"], "format": "date-time"},
          "previous_release_id": {"type": ["string", "null"]},
          "change_ids": {"type": "array", "items": {"type": "string"}},
          "record_counts": {"type": "object", "additionalProperties": {"type": "integer", "minimum": 0}},
          "record_count_diff": {"type": "object", "additionalProperties": {"type": "integer"}},
          "closeout": {"type": "string"}
        },
        "additionalProperties": false
      }
    },
    "changes": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": ["title", "summary"],
          "properties": {
            "title": {"$ref": "#/$defs/localizedText"},
          "summary": {"$ref": "#/$defs/localizedText"},
          "reason": {"$ref": "#/$defs/localizedText"}
        },
        "additionalProperties": false
      }
    }
  },
  "$defs": {
    "localizedText": {
      "type": "object",
      "required": ["ru", "kk", "en"],
      "properties": {
        "ru": {"type": "string"},
        "kk": {"type": "string"},
        "en": {"type": "string"}
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
