{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://getzero.dev/contracts/zero.coliseum.paper_bracket.v0.schema.json",
  "title": "ZERO Coliseum paper bracket v0",
  "description": "Public read-only paper tournament bracket for replay-backed ZERO League promotion.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "kind",
    "public",
    "mode",
    "cadence",
    "status",
    "generated_at",
    "tournament",
    "execution_boundary",
    "scoring",
    "entrants",
    "winner",
    "replay_evidence"
  ],
  "properties": {
    "schema_version": { "const": "zero.coliseum.paper_bracket.v0" },
    "kind": { "const": "coliseum_paper_bracket" },
    "public": { "const": true },
    "mode": { "const": "paper" },
    "cadence": { "const": "weekly" },
    "status": { "const": "published" },
    "generated_at": { "type": "string", "format": "date-time" },
    "tournament": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "name", "week_start", "week_end", "bracket_url", "league_url"],
      "properties": {
        "id": { "type": "string", "minLength": 8 },
        "name": { "const": "Genesis Paper Bracket" },
        "week_start": { "type": "string", "format": "date" },
        "week_end": { "type": "string", "format": "date" },
        "bracket_url": { "const": "https://getzero.dev/proof" },
        "league_url": { "const": "https://getzero.dev/proof" }
      }
    },
    "execution_boundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "can_execute_orders",
        "auto_execution_enabled",
        "private_keys_required",
        "live_promotion_requires_operator_lease",
        "default_disciple_mode"
      ],
      "properties": {
        "can_execute_orders": { "const": false },
        "auto_execution_enabled": { "const": false },
        "private_keys_required": { "const": false },
        "live_promotion_requires_operator_lease": { "const": true },
        "default_disciple_mode": { "const": "signal_only" }
      }
    },
    "scoring": {
      "type": "object",
      "additionalProperties": false,
      "required": ["schema_version", "points", "promotion_rules", "disqualification_rules"],
      "properties": {
        "schema_version": { "const": "zero.coliseum.scoring.v0" },
        "points": {
          "type": "object",
          "additionalProperties": { "type": "integer", "minimum": 0 },
          "required": [
            "replay_quality",
            "risk_policy",
            "signed_receipt",
            "paper_decision",
            "private_key_free_runtime",
            "pnl_cap"
          ]
        },
        "promotion_rules": { "type": "array", "minItems": 3, "items": { "type": "string", "minLength": 12 } },
        "disqualification_rules": { "type": "array", "minItems": 3, "items": { "type": "string", "minLength": 12 } }
      }
    },
    "entrants": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/entrant" }
    },
    "winner": { "$ref": "#/$defs/entrant" },
    "replay_evidence": {
      "type": "object",
      "additionalProperties": false,
      "required": ["required", "public_replay_index_url", "export_url", "decision_loop_required"],
      "properties": {
        "required": { "const": true },
        "public_replay_index_url": { "const": "https://getzero.dev/replay" },
        "export_url": { "const": "https://getzero.dev/api/replays/export?limit=20" },
        "decision_loop_required": { "const": true }
      }
    }
  },
  "$defs": {
    "entrant": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "rank",
        "entrant_id",
        "display_name",
        "operator_handle",
        "agent_short_id",
        "source",
        "league_tier",
        "score",
        "paper_pnl_usd",
        "decisions",
        "replay_quality",
        "risk_policy",
        "replay_evidence_url",
        "public_profile_url",
        "disqualified",
        "blockers"
      ],
      "properties": {
        "rank": { "type": "integer", "minimum": 1 },
        "entrant_id": { "type": "string", "minLength": 3 },
        "display_name": { "type": "string", "minLength": 3 },
        "operator_handle": { "type": "string", "minLength": 3 },
        "agent_short_id": { "type": "string", "minLength": 3 },
        "source": { "enum": ["public_operator", "paper_fixture"] },
        "league_tier": { "enum": ["Bronze", "Silver", "Gold", "Diamond", "Mythic"] },
        "score": { "type": "integer", "minimum": 0 },
        "paper_pnl_usd": { "type": "number" },
        "decisions": { "type": "integer", "minimum": 0 },
        "replay_quality": { "enum": ["complete", "partial"] },
        "risk_policy": { "type": "string", "minLength": 3 },
        "replay_evidence_url": { "type": "string", "pattern": "^/(api/replays|replay)" },
        "public_profile_url": { "type": "string", "pattern": "^/(u|a)/" },
        "disqualified": { "type": "boolean" },
        "blockers": { "type": "array", "items": { "type": "string" } }
      }
    }
  }
}
