{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "official",
  "type": "object",
  "required": ["published_at", "headline", "components", "quotes"],
  "additionalProperties": false,
  "properties": {
    "published_at": {"type": "string"},
    "headline": {
      "type": "object",
      "required": ["cpi", "core"],
      "additionalProperties": false,
      "properties": {
        "cpi": {"$ref": "#/$defs/headline_row"},
        "core": {"$ref": "#/$defs/headline_row"},
        "pce": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/headline_row"}]},
        "core_pce": {"oneOf": [{"type": "null"}, {"$ref": "#/$defs/headline_row"}]}
      }
    },
    "components": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["code", "label", "month", "yoy_pct", "mom_pct"],
        "additionalProperties": false,
        "properties": {
          "code": {"type": "string"},
          "label": {"type": "string"},
          "month": {"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"},
          "yoy_pct": {"type": "number"},
          "mom_pct": {"type": "number"}
        }
      }
    },
    "quotes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["code", "label", "group", "unit", "latest", "obs_date", "yoy_pct"],
        "additionalProperties": false,
        "properties": {
          "code": {"type": "string"},
          "label": {"type": "string"},
          "group": {"enum": ["grocery", "energy", "rates", "markets", "fiscal"]},
          "unit": {"type": "string"},
          "latest": {"type": "number"},
          "obs_date": {"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"},
          "yoy_pct": {"type": ["number", "null"]},
          "yoy_pp": {"type": ["number", "null"]}
        }
      }
    }
  },
  "$defs": {
    "headline_row": {
      "type": "object",
      "required": ["month", "yoy_pct", "prev_yoy_pct", "as_of"],
      "additionalProperties": false,
      "properties": {
        "month": {"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"},
        "yoy_pct": {"type": "number"},
        "prev_yoy_pct": {"type": "number"},
        "as_of": {"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}
      }
    }
  }
}
