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

ROOT = Path(__file__).resolve().parents[1]
HEADER = ROOT / "Source" / "AgrarianGame" / "AgrarianBuildingPlacementComponent.h"
SOURCE = ROOT / "Source" / "AgrarianGame" / "AgrarianBuildingPlacementComponent.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, "FAgrarianBuildPreviewUpdatedSignature")
    require(HEADER, "OnBuildPreviewUpdated")
    require(HEADER, "bShowGhostPreview")
    require(HEADER, "GetPlacementPreviewState")
    require(HEADER, "TickComponent")
    require(SOURCE, "DrawDebugBox")
    require(SOURCE, "ValidGhostPreviewColor")
    require(SOURCE, "InvalidGhostPreviewColor")
    require(SOURCE, "OnBuildPreviewUpdated.Broadcast")
    require(ROADMAP, "[x] Add ghost preview.")
    require(TECHNICAL_DESIGN, "green/red wireframe ghost footprint")
    print("PASS: building ghost preview support is present.")


if __name__ == "__main__":
    main()
