#!/usr/bin/env python3
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
HEADER = ROOT / "Source" / "AgrarianGame" / "AgrarianShelterActor.h"
SOURCE = ROOT / "Source" / "AgrarianGame" / "AgrarianShelterActor.cpp"
ROADMAP = ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md"
TECHNICAL_DESIGN = ROOT / "Docs" / "TechnicalDesignDocument.md"


def compact(path: Path) -> str:
    return " ".join(path.read_text(encoding="utf-8").split())


def require(path: Path, text: str) -> None:
    data = compact(path)
    if text not in data:
        raise SystemExit(f"FAIL: {path.relative_to(ROOT)} missing required text: {text}")


def main() -> None:
    require(HEADER, "public AActor, public IAgrarianPersistentStateProvider")
    require(HEADER, "MaxStructureHealth")
    require(HEADER, "CurrentStructureHealth")
    require(HEADER, "ApplyStructureDamage")
    require(HEADER, "RepairStructure")
    require(HEADER, "Deconstruct")
    require(HEADER, "GetStructureHealthRatio")
    require(HEADER, "IsStructureDamaged")
    require(SOURCE, "DOREPLIFETIME(AAgrarianShelterActor, MaxStructureHealth)")
    require(SOURCE, "DOREPLIFETIME(AAgrarianShelterActor, CurrentStructureHealth)")
    require(SOURCE, "TakeDamage")
    require(SOURCE, "current_structure_health")
    require(SOURCE, "max_structure_health")
    require(SOURCE, "Destroy()")
    require(ROADMAP, "[x] Add deconstruction or damage placeholder.")
    require(TECHNICAL_DESIGN, "version 0.1 structure damage placeholder")
    print("PASS: shelter damage and deconstruction placeholder is present.")


if __name__ == "__main__":
    main()
