{
  "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object",
  "required": ["published_at", "target", "release_date", "reference_month", "cpi", "pce", "nfp", "benchmarks", "ensemble", "generated_on"],
  "properties": {
    "published_at": {"type": "string"}, "target": {"const": "CPI"},
    "release_date": {"type": ["string", "null"]}, "reference_month": {"type": ["string", "null"]},
    "cpi": {"$ref": "#/$defs/forecast"},
    "pce": {"allOf": [{"$ref": "#/$defs/forecast"}, {"properties": {
      "reference_month": {"type": ["string", "null"], "description": "the next PCE release's reference month (added 2026-09-28; older payloads rode the CPI month)"},
      "release_date": {"type": ["string", "null"]},
      "bridge": {"enum": ["cpi", "cpi+ppi", null]},
      "bridge_note": {"type": "string"},
      "cpi_input": {"oneOf": [{"type": "null"}, {"type": "object", "required": ["source", "series", "mom_pct"],
        "properties": {"source": {"enum": ["actual", "nowcast", "nowcast_nsa"]}, "series": {"type": "string"}, "mom_pct": {"type": "number"}}}]},
      "benchmarks": {"$ref": "#/$defs/benchmarks"},
      "core": {"type": "object", "required": ["mom_pct", "status", "parameters"], "properties": {
        "mom_pct": {"type": ["number", "null"]}, "status": {"enum": ["live", "unavailable"]},
        "parameters": {"type": "object"}, "benchmarks": {"$ref": "#/$defs/benchmarks"}}}
    }}]},
    "nfp": {"oneOf": [{"type": "null"},
      {"type": "object", "required": ["change_thousands", "reference_month", "status"]}]},
    "benchmarks": {"type": "object", "additionalProperties": {"oneOf": [
      {"type": "null"},
      {"type": "object", "required": ["value", "as_of"],
       "properties": {"value": {"type": "number"}, "as_of": {"type": "string"}}}
    ]}},
    "ensemble": {"type": "object"}, "generated_on": {"type": "string"}
  },
  "$defs": {"benchmarks": {"type": "object", "additionalProperties": {"type": "object", "required": ["value", "as_of"],
      "properties": {"value": {"type": "number"}, "as_of": {"type": "string"}}}},
    "forecast": {"type": "object", "required": ["mom_pct", "status", "as_of", "parameters"],
    "properties": {
      "components": {
        "type": "array",
        "items": {
          "type": "object",
          "required": ["component", "mom_pct", "weight", "contribution_pp", "basis"],
          "properties": {
            "component": {"type": "string"},
            "mom_pct": {"type": "number"},
            "weight": {"type": "number"},
            "contribution_pp": {"type": "number"},
            "basis": {"enum": ["measured", "trend", "trend+driver"]},
            "driver_mom_pct": {"type": "number"}
          }
        }
      }
    }}}
}
