#!/usr/bin/env python3
"""Verify fire suppression hooks cover rain, water, dirt/sand, firebreaks, and tools."""

from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
FIRE_H = ROOT / "Source" / "AgrarianGame" / "AgrarianCampfire.h"
FIRE_CPP = ROOT / "Source" / "AgrarianGame" / "AgrarianCampfire.cpp"
TDD = ROOT / "Docs" / "TechnicalDesignDocument.md"
ROADMAP = ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md"

REQUIRED = {
    FIRE_H: [
        "WaterSuppressionStrength",
        "DirtSandSuppressionStrength",
        "FirebreakSuppressionStrength",
        "ToolSuppressionStrength",
        "void ApplyFireSuppression(float SuppressionAmount, FName SuppressionSource);",
        "void ApplyWaterSuppression();",
        "void ApplyDirtSandSuppression();",
        "void ApplyFirebreakSuppression();",
        "void ApplyToolSuppression();",
        "void ReduceActiveFireIntensity(float Amount);",
    ],
    FIRE_CPP: [
        "AAgrarianCampfire::ApplyFireSuppression",
        "ApplyFireSuppression(WaterSuppressionStrength, TEXT(\"water\"))",
        "ApplyFireSuppression(DirtSandSuppressionStrength, TEXT(\"dirt_sand\"))",
        "ApplyFireSuppression(FirebreakSuppressionStrength, TEXT(\"firebreak\"))",
        "ApplyFireSuppression(ToolSuppressionStrength, TEXT(\"tool\"))",
        "FireSuppressionPressure = FMath::Clamp",
        "ReduceFireRisks(SafeSuppressionAmount);",
        "ReduceActiveFireIntensity(SafeSuppressionAmount);",
        "SuppressionSource == TEXT(\"rain\") || SuppressionSource == TEXT(\"water\")",
        "AAgrarianCampfire::ReduceActiveFireIntensity",
        "IsWetWeatherActive()",
    ],
    TDD: [
        "Fire suppression uses explicit server-side hooks",
        "`ApplyFireSuppression`",
        "water",
        "dirt/sand",
        "firebreaks",
        "future tools",
    ],
    ROADMAP: [
        "[x] Add fire suppression hooks",
    ],
}


def main() -> None:
    missing = []
    for path, snippets in REQUIRED.items():
        text = path.read_text(encoding="utf-8")
        for snippet in snippets:
            if snippet not in text:
                missing.append(f"{path.relative_to(ROOT)} missing {snippet!r}")
    if missing:
        raise SystemExit("FAILED: " + "; ".join(missing))
    print("OK: fire suppression hooks are implemented.")


if __name__ == "__main__":
    main()
