{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codex-reset-com/json-schema/codex-reset-com-forecast-schema.json",
  "title": "Forecast",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/codex-reset-com-openapi.yml#/components/schemas/Forecast",
  "type": "object",
  "required": [
    "updated_at",
    "probabilities",
    "confidence",
    "last_reset_at",
    "official_signal",
    "latest_alert"
  ],
  "properties": {
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "probabilities": {
      "$ref": "#/$defs/Probabilities"
    },
    "confidence": {
      "type": "string"
    },
    "last_reset_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "official_signal": {
      "anyOf": [
        {
          "type": "object",
          "description": "The currently active Watch only; null once its window closes, a later Reset lands, or a banked reset answers it."
        },
        {
          "type": "null"
        }
      ]
    },
    "context": {
      "type": "object",
      "description": "Tibo context of the last seven days (QUIET / TEASE / UNCLEAR). Informational only: never changes the probabilities."
    },
    "wait_comparison": {
      "anyOf": [
        {
          "type": "object",
          "description": "The current wait against the latest eight completed reset intervals."
        },
        {
          "type": "null"
        }
      ]
    },
    "model": {
      "type": "object"
    },
    "backtest": {
      "type": "object"
    },
    "latest_alert": {
      "anyOf": [
        {
          "$ref": "#/$defs/LatestAlert"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "$defs": {
    "AlertWindow": {
      "type": "object",
      "required": [
        "label",
        "start_at",
        "end_at",
        "time_zone"
      ],
      "properties": {
        "label": {
          "type": "string"
        },
        "start_at": {
          "type": "string",
          "format": "date-time"
        },
        "end_at": {
          "type": "string",
          "format": "date-time"
        },
        "time_zone": {
          "type": "string",
          "description": "IANA time zone of Tibo's words."
        },
        "target_kind": {
          "type": "string"
        },
        "target_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "LatestAlert": {
      "type": "object",
      "description": "The canonical Alert: the latest ⚠️ Watch or ✅ Reset. Retained until a newer Alert replaces it.",
      "required": [
        "id",
        "kind",
        "state",
        "source_at",
        "summary",
        "score",
        "window",
        "corrected"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "watch",
            "reset"
          ]
        },
        "state": {
          "type": "string",
          "enum": [
            "active",
            "expired",
            "confirmed"
          ],
          "description": "A Watch is active or expired; a Reset is confirmed."
        },
        "source_at": {
          "type": "string",
          "format": "date-time"
        },
        "summary": {
          "type": "string"
        },
        "url": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "score": {
          "anyOf": [
            {
              "type": "integer",
              "enum": [
                83,
                93
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "window": {
          "anyOf": [
            {
              "$ref": "#/$defs/AlertWindow"
            },
            {
              "type": "null"
            }
          ]
        },
        "pending": {
          "type": "string",
          "enum": [
            "done",
            "on_its_way"
          ],
          "description": "⌛️ A Watch rung by Tibo's own completion statement before the site's monitor measured the reset; score and window are then null."
        },
        "corrected": {
          "type": "boolean"
        },
        "confirmation_source": {
          "type": "string"
        },
        "observed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "observation_message": {
          "type": "string"
        },
        "confirmed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "confirmation_url": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "localized_summary": {
          "type": "string",
          "description": "Locale responses only."
        },
        "translation_status": {
          "type": "string",
          "description": "Locale responses only."
        }
      }
    },
    "Probabilities": {
      "type": "object",
      "required": [
        "rounded_24h",
        "rounded_48h"
      ],
      "properties": {
        "rounded_24h": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100,
          "description": "Chance (%) of a reset in the next 24 hours."
        },
        "rounded_48h": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100,
          "description": "Chance (%) of a reset in the next 48 hours."
        },
        "raw_24h": {
          "type": "number"
        },
        "raw_48h": {
          "type": "number"
        },
        "range_24h": {
          "type": "object",
          "description": "Wilson sampling band; informational."
        },
        "range_48h": {
          "type": "object",
          "description": "Wilson sampling band; informational."
        }
      }
    }
  }
}