#!/usr/bin/env python3
"""Verify the real-GPU packaged startup visual test gate is documented."""

from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
DOC = ROOT / "Docs" / "Ops" / "PackagedClientGpuStartupVisualTest.md"
BAT = ROOT / "Scripts" / "RunWindowsGpuStartupVisualCheck.bat"
ROADMAP = ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md"


def require(condition: bool, message: str) -> None:
    if not condition:
        raise SystemExit(f"FAILED: {message}")


def main() -> None:
    doc = DOC.read_text(encoding="utf-8")
    bat = BAT.read_text(encoding="utf-8")
    roadmap = ROADMAP.read_text(encoding="utf-8")

    for token in (
        "Do not use QEMU guest-agent screenshots",
        "Sunshine",
        "Moonlight",
        "Builds\\WindowsDevelopment",
        "01-startup-credits",
        "02-character-selection",
        "03-server-join",
        "04-loading",
        "05-first-spawn",
        "06-pause-menu",
        "07-save-quit",
        "visual-startup-check.txt",
    ):
        require(token in doc, f"visual startup test doc missing {token!r}")

    for token in (
        "SunshineService",
        "Builds\\WindowsDevelopment",
        "AgrarianGame.exe",
        "--check-tools",
        "Do not use QEMU guest-agent screenshots",
        "01-startup-credits",
        "07-save-quit",
    ):
        require(token in bat, f"Windows visual startup helper missing {token!r}")

    require(
        "- [x] Add a visually verified packaged-client startup test using Sunshine/Moonlight or another real GPU desktop capture path" in roadmap,
        "0.1.O real-GPU startup visual test roadmap item is not checked off",
    )

    print("OK: packaged-client real-GPU startup visual test gate is documented and scripted.")


if __name__ == "__main__":
    main()
