from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
HUD_HEADER = ROOT / "Source" / "AgrarianGame" / "AgrarianDebugHUD.h"
HUD_SOURCE = ROOT / "Source" / "AgrarianGame" / "AgrarianDebugHUD.cpp"
CHARACTER_HEADER = ROOT / "Source" / "AgrarianGame" / "AgrarianGameCharacter.h"


EXPECTED_HUD_HEADER_SNIPPETS = [
    "void DrawPlayerStatus(const class AAgrarianGameCharacter* AgrarianCharacter, float X, float& Y);",
]

EXPECTED_HUD_SOURCE_SNIPPETS = [
    "#include \"GameFramework/CharacterMovementComponent.h\"",
    "DrawPlayerStatus(AgrarianCharacter, X, Y);",
    "void AAgrarianDebugHUD::DrawPlayerStatus",
    "Role:",
    "Location:",
    "Speed:",
    "Stance:",
    "Move Mult:",
    "Age %.1f | Cond %.2f | Str %.2f | End %.2f | Terrain %.2f",
]

EXPECTED_CHARACTER_HEADER_SNIPPETS = [
    "float GetAgeYears() const",
    "float GetPhysicalConditionMultiplier() const",
    "float GetStrengthMultiplier() const",
    "float GetEnduranceMultiplier() const",
    "float GetTerrainMovementMultiplier() const",
]


def assert_contains(label, text, snippets):
    missing = [snippet for snippet in snippets if snippet not in text]
    if missing:
        raise RuntimeError(f"{label} is missing expected debug overlay snippets: {missing}")


def main():
    assert_contains("AgrarianDebugHUD.h", HUD_HEADER.read_text(encoding="utf-8"), EXPECTED_HUD_HEADER_SNIPPETS)
    assert_contains("AgrarianDebugHUD.cpp", HUD_SOURCE.read_text(encoding="utf-8"), EXPECTED_HUD_SOURCE_SNIPPETS)
    assert_contains("AgrarianGameCharacter.h", CHARACTER_HEADER.read_text(encoding="utf-8"), EXPECTED_CHARACTER_HEADER_SNIPPETS)
    print("Agrarian player debug overlay verification complete.")


if __name__ == "__main__":
    main()
