"""Pure persistence contracts for tournament orchestration."""

from __future__ import annotations

import json
from typing import Any


def parse_checkpoint_document(raw: str) -> dict[str, Any] | None:
    """Return a supported checkpoint object, or ``None`` for invalid input."""
    try:
        data = json.loads(raw)
    except json.JSONDecodeError:
        return None
    if not isinstance(data, dict) or data.get("version") != 1:
        return None
    return data
