from pathlib import Path


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

EXPECTED = {
    "AgrarianDebugHUD.h": [
        "bool bShowCriticalStatsHUD = true;",
        "float CriticalStatsTextScale = 1.0f;",
        "void DrawCriticalStats(const UAgrarianSurvivalComponent* SurvivalComponent);",
        "void DrawScaledLine(const FString& Text, float X, float& Y, float Scale, const FColor& Color = FColor::White);",
    ],
    "AgrarianDebugHUD.cpp": [
        "DrawCriticalStats(AgrarianCharacter->GetSurvivalComponent());",
        "void AAgrarianDebugHUD::DrawCriticalStats",
        "SURVIVAL",
        "Health",
        "Stamina",
        "Food",
        "Water",
        "Temp",
        "Exhaust",
        "Injury",
        "Sickness",
        "StatusColor",
        "void AAgrarianDebugHUD::DrawScaledLine",
    ],
}


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("Critical stats HUD verification failed: " + "; ".join(missing))

    print("Agrarian critical stats HUD verification complete.")


if __name__ == "__main__":
    main()
