from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
FILES = {
    "AgrarianMvpFrontendWidget.h": ROOT / "Source" / "AgrarianGame" / "AgrarianMvpFrontendWidget.h",
    "AgrarianMvpFrontendWidget.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianMvpFrontendWidget.cpp",
    "AgrarianGamePlayerController.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp",
    "AGRARIAN_DEVELOPMENT_ROADMAP.md": ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md",
}

EXPECTED = {
    "AgrarianMvpFrontendWidget.h": [
        "Loading",
        "DrawLoading",
    ],
    "AgrarianMvpFrontendWidget.cpp": [
        "EAgrarianMvpFrontendScreen::Loading",
        "SetActiveScreen(EAgrarianMvpFrontendScreen::Loading)",
        "Preparing Ground Zero",
        "Loading terrain, weather, survival state, and server session data.",
        "Enter Ground Zero",
        "CompleteFrontendFlow",
        "BarSize.X * 0.62f",
    ],
    "AgrarianGamePlayerController.cpp": [
        "MVP frontend screen: loading.",
        "Usage: AgrarianShowMvpScreen main|character|join|loading",
    ],
    "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
        "[x] Add loading screen.",
        "`Loading`",
        "Ground Zero preparation",
    ],
}


def main():
    missing = []
    for label, path in FILES.items():
        text = path.read_text(encoding="utf-8")
        for snippet in EXPECTED[label]:
            if snippet not in text:
                missing.append(f"{label}: {snippet}")

    if missing:
        raise RuntimeError("MVP loading screen verification failed: " + "; ".join(missing))

    print("Agrarian MVP loading screen verification complete.")


if __name__ == "__main__":
    main()
