{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mantic/json-schema/mantic-get-race-response-schema.json",
  "title": "GetRaceResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mantic-elections-api-openapi.yml#/components/schemas/GetRaceResponse",
  "properties": {
    "slug": {
      "type": "string",
      "title": "Slug"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "race_type": {
      "type": "string",
      "title": "Race Type"
    },
    "electoral_system": {
      "type": "string",
      "title": "Electoral System"
    },
    "chamber": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Chamber"
    },
    "jurisdiction": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Jurisdiction"
    },
    "seats_total": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Seats Total"
    },
    "majority_threshold": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Majority Threshold"
    },
    "electoral_threshold_pct": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Electoral Threshold Pct"
    },
    "rounds": {
      "type": "integer",
      "title": "Rounds"
    },
    "runoff_rule": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Runoff Rule"
    },
    "incumbent": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Incumbent"
    },
    "event": {
      "$ref": "#/$defs/RaceEventResponse"
    },
    "runoff_event": {
      "anyOf": [
        {
          "$ref": "#/$defs/RaceEventResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "parties": {
      "items": {
        "$ref": "#/$defs/RacePartyResponse"
      },
      "type": "array",
      "title": "Parties"
    },
    "questions": {
      "items": {
        "$ref": "#/$defs/RaceQuestionResponse"
      },
      "type": "array",
      "title": "Questions"
    },
    "sibling_race_count": {
      "type": "integer",
      "title": "Sibling Race Count"
    }
  },
  "type": "object",
  "required": [
    "slug",
    "title",
    "race_type",
    "electoral_system",
    "chamber",
    "jurisdiction",
    "seats_total",
    "majority_threshold",
    "electoral_threshold_pct",
    "rounds",
    "runoff_rule",
    "incumbent",
    "event",
    "runoff_event",
    "parties",
    "questions",
    "sibling_race_count"
  ],
  "$defs": {
    "ForecastIntervalResponse": {
      "properties": {
        "lower": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Lower"
        },
        "upper": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Upper"
        }
      },
      "type": "object",
      "required": [
        "lower",
        "upper"
      ],
      "title": "ForecastIntervalResponse"
    },
    "RaceEventResponse": {
      "properties": {
        "slug": {
          "type": "string",
          "title": "Slug"
        },
        "country": {
          "type": "string",
          "title": "Country"
        },
        "geo_level": {
          "type": "string",
          "title": "Geo Level"
        },
        "polling_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Polling Date"
        },
        "date_precision": {
          "type": "string",
          "enum": [
            "fixed",
            "expected",
            "deadline",
            "unknown"
          ],
          "title": "Date Precision"
        },
        "date_window_start": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Date Window Start"
        },
        "date_window_end": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Date Window End"
        },
        "stage": {
          "type": "string",
          "title": "Stage"
        },
        "round_number": {
          "type": "integer",
          "title": "Round Number"
        },
        "region_codes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Region Codes"
        }
      },
      "type": "object",
      "required": [
        "slug",
        "country",
        "geo_level",
        "polling_date",
        "date_precision",
        "date_window_start",
        "date_window_end",
        "stage",
        "round_number",
        "region_codes"
      ],
      "title": "RaceEventResponse"
    },
    "RaceForecastResponse": {
      "properties": {
        "execution_id": {
          "type": "integer",
          "title": "Execution Id"
        },
        "completed_at": {
          "type": "string",
          "format": "date-time",
          "title": "Completed At"
        },
        "kind": {
          "type": "string",
          "title": "Kind"
        },
        "outcomes": {
          "items": {
            "$ref": "#/$defs/RaceOutcomeResponse"
          },
          "type": "array",
          "title": "Outcomes",
          "default": []
        },
        "central_value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Central Value"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unit"
        },
        "probability": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Probability"
        },
        "interval_50": {
          "anyOf": [
            {
              "$ref": "#/$defs/ForecastIntervalResponse"
            },
            {
              "type": "null"
            }
          ]
        },
        "interval_80": {
          "anyOf": [
            {
              "$ref": "#/$defs/ForecastIntervalResponse"
            },
            {
              "type": "null"
            }
          ]
        },
        "median_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Median Date"
        }
      },
      "type": "object",
      "required": [
        "execution_id",
        "completed_at",
        "kind"
      ],
      "title": "RaceForecastResponse"
    },
    "RaceOutcomeResponse": {
      "properties": {
        "category_id": {
          "type": "integer",
          "title": "Category Id"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "probability": {
          "type": "number",
          "title": "Probability"
        },
        "kind": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Kind"
        },
        "party_key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Party Key"
        },
        "party_keys": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Party Keys"
        }
      },
      "type": "object",
      "required": [
        "category_id",
        "title",
        "probability",
        "kind",
        "party_key",
        "party_keys"
      ],
      "title": "RaceOutcomeResponse"
    },
    "RacePartyResponse": {
      "properties": {
        "party_key": {
          "type": "string",
          "title": "Party Key"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "short_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Short Name"
        },
        "native_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Native Name"
        },
        "colour_slot": {
          "type": "string",
          "title": "Colour Slot"
        },
        "kind": {
          "type": "string",
          "title": "Kind"
        },
        "bloc_of": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bloc Of"
        },
        "is_incumbent": {
          "type": "boolean",
          "title": "Is Incumbent"
        }
      },
      "type": "object",
      "required": [
        "party_key",
        "name",
        "short_name",
        "native_name",
        "colour_slot",
        "kind",
        "bloc_of",
        "is_incumbent"
      ],
      "title": "RacePartyResponse"
    },
    "RaceQuestionResponse": {
      "properties": {
        "question_id": {
          "type": "integer",
          "title": "Question Id"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "role": {
          "type": "string",
          "enum": [
            "headline",
            "runoff",
            "vote_share",
            "seat_count",
            "placement",
            "turnout",
            "government_formation",
            "related"
          ],
          "title": "Role"
        },
        "source": {
          "type": "string",
          "enum": [
            "curated",
            "suggested",
            "scheduled"
          ],
          "title": "Source"
        },
        "party_key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Party Key"
        },
        "is_resolved": {
          "type": "boolean",
          "title": "Is Resolved"
        },
        "resolved_value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Resolved Value"
        },
        "latest_forecast": {
          "anyOf": [
            {
              "$ref": "#/$defs/RaceForecastResponse"
            },
            {
              "type": "null"
            }
          ]
        },
        "execution_count": {
          "type": "integer",
          "title": "Execution Count"
        }
      },
      "type": "object",
      "required": [
        "question_id",
        "title",
        "role",
        "source",
        "party_key",
        "is_resolved",
        "resolved_value",
        "execution_count"
      ],
      "title": "RaceQuestionResponse"
    }
  }
}