"""Market structure snapshot — lightweight stub for trial compatibility."""

from pathlib import Path
from typing import Any, Optional


def load_structure_snapshot(valid_only: bool = False) -> Optional[dict[str, Any]]:
    """Load cached market structure snapshot. Returns None if unavailable."""
    import config_manager
    p = config_manager.get_data_dir() / "market_structure_snapshot.json"
    if not p.exists():
        return None
    try:
        import json
        return json.loads(p.read_text(encoding="utf-8"))
    except Exception:
        return None
