{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cortist.com/data/forecasts/schema-v1.json",
  "title": "Cortist forecast snapshot v1.0",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "forecast_id",
    "snapshot_version",
    "recorded_date",
    "publication_state",
    "scoring_eligible",
    "question",
    "probability",
    "target_deadline_utc",
    "resolution_rules",
    "revision_reason",
    "sources",
    "editorial_disclaimer"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0"
    },
    "forecast_id": {
      "type": "string",
      "pattern": "^F-[0-9]{3}$"
    },
    "snapshot_version": {
      "type": "string",
      "pattern": "^v[0-9]+\\.[0-9]+$"
    },
    "recorded_date": {
      "type": "string",
      "format": "date"
    },
    "publication_state": {
      "enum": [
        "draft",
        "locked"
      ]
    },
    "locked_at_utc": {
      "type": [
        "string",
        "null"
      ]
    },
    "scoring_eligible": {
      "type": "boolean"
    },
    "question": {
      "type": "string",
      "minLength": 25
    },
    "probability": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "target_deadline_utc": {
      "type": "string"
    },
    "resolution_rules": {
      "type": "object",
      "required": [
        "state",
        "draft_criteria",
        "open_decisions",
        "accepted_evidence",
        "adjudication"
      ],
      "additionalProperties": false,
      "properties": {
        "state": {
          "enum": [
            "proposed",
            "locked"
          ]
        },
        "draft_criteria": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "open_decisions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "accepted_evidence": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "adjudication": {
          "type": "string"
        }
      }
    },
    "revision_reason": {
      "type": "string"
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "prior_launch_draft_percent": {
      "type": "number"
    },
    "prior_launch_draft_note": {
      "type": "string"
    },
    "model": {
      "type": "string"
    },
    "editorial_disclaimer": {
      "type": "string"
    },
    "notes": {
      "type": "string"
    }
  }
}
