from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]


def require(path: Path, snippet: str) -> None:
    text = path.read_text(encoding="utf-8")
    if snippet not in text:
        raise SystemExit(f"{path.relative_to(ROOT)} missing {snippet!r}")


def main() -> None:
    types = ROOT / "Source" / "AgrarianGame" / "AgrarianTypes.h"
    header = ROOT / "Source" / "AgrarianGame" / "AgrarianSurvivalComponent.h"
    source = ROOT / "Source" / "AgrarianGame" / "AgrarianSurvivalComponent.cpp"
    hud = ROOT / "Source" / "AgrarianGame" / "AgrarianDebugHUD.cpp"
    controller = ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp"
    roadmap = ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md"

    require(types, "float BleedingSeverity = 0.0f;")
    require(header, "float BleedingDamagePerMinute = 2.0f;")
    require(header, "float BleedingExhaustionPerSecond = 0.04f;")
    require(header, "void AddBleeding(float Severity);")
    require(header, "void ReduceBleeding(float Amount);")
    require(source, "Survival.Health -= BleedingDamagePerMinute * BleedingRatio * Minutes;")
    require(source, "Survival.Exhaustion += BleedingExhaustionPerSecond * BleedingRatio * DeltaTime;")
    require(source, "Survival.BleedingSeverity += PositiveSeverity * 0.35f;")
    require(source, "void UAgrarianSurvivalComponent::AddBleeding")
    require(source, "void UAgrarianSurvivalComponent::ReduceBleeding")
    require(source, "Survival.BleedingSeverity = FMath::Clamp(Survival.BleedingSeverity, 0.0f, 100.0f);")
    require(hud, "Bleeding")
    require(hud, "Bleed:")
    require(controller, "Bleeding %.1f")
    require(roadmap, "[x] Add bleeding placeholder.")

    print("PASS: bleeding placeholder is present.")


if __name__ == "__main__":
    main()
