{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "DashboardPayload",
  "description": "Schema for the daily Market Mayhem dashboard data payload, designed for direct hydration of Tailwind UI and Chart.js components.",
  "type": "object",
  "required": [
    "schema_version",
    "timestamp",
    "telemetry",
    "traces",
    "simulator"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "description": "Semantic versioning of the schema.",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of the pipeline execution."
    },
    "telemetry": {
      "type": "object",
      "description": "Current market metrics mapped to UI status cards.",
      "required": [
        "spx_level",
        "10y_yield_bps",
        "hy_spread_bps",
        "cre_pd_merton"
      ],
      "properties": {
        "spx_level": {
          "type": "number",
          "description": "S&P 500 Index level."
        },
        "10y_yield_bps": {
          "type": "integer",
          "description": "US 10-Year Treasury yield in basis points."
        },
        "hy_spread_bps": {
          "type": "integer",
          "description": "High Yield credit spread in basis points."
        },
        "cre_pd_merton": {
          "type": "number",
          "description": "Commercial Real Estate probability of default (Merton model output).",
          "minimum": 0,
          "maximum": 1
        }
      }
    },
    "traces": {
      "type": "object",
      "description": "Log of calculation provenance for terminal display.",
      "required": [
        "provenance_edges"
      ],
      "properties": {
        "provenance_edges": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "source"
            ],
            "properties": {
              "source": {
                "type": "string",
                "description": "The name of the plugin or module that generated the data."
              },
              "cluster_id": {
                "type": "string",
                "description": "Identifier for the thematic cluster (e.g., from MarketCatalystPlugin)."
              },
              "confidence_score": {
                "type": "number",
                "description": "Confidence metric for the observation.",
                "minimum": 0,
                "maximum": 1
              },
              "regime": {
                "type": "string",
                "description": "Identified market regime (e.g., from Mod-77ab-Copula)."
              },
              "crypto_spx_corr": {
                "type": "number",
                "description": "Calculated correlation between Crypto and SPX.",
                "minimum": -1,
                "maximum": 1
              }
            }
          }
        }
      }
    },
    "simulator": {
      "type": "object",
      "description": "Inputs bound to the active scenario state for front-end simulation models.",
      "required": [
        "merton_active_scenario",
        "delta_spread_shock"
      ],
      "properties": {
        "merton_active_scenario": {
          "type": "string",
          "description": "The name of the currently active Merton model scenario (e.g., 'Baseline', 'Stress')."
        },
        "delta_spread_shock": {
          "type": "integer",
          "description": "The simulated shock to credit spreads in basis points."
        }
      }
    }
  }
}
