from pathlib import Path


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

REQUIRED = {
    ROOT / "Source" / "AgrarianGame" / "AgrarianCampfire.h": [
        "#include \"AgrarianTypes.h\"",
        "float RainFuelDrainMultiplier = 1.5f;",
        "float StormFuelDrainMultiplier = 2.5f;",
        "float WetWeatherExtinguishFuelThresholdSeconds = 6.0f;",
        "bool bWetWeatherCanExtinguish = true;",
        "float GetWeatherFuelDrainMultiplier() const;",
        "bool IsWetWeatherActive() const;",
        "EAgrarianWeatherType GetCurrentWeather() const;",
    ],
    ROOT / "Source" / "AgrarianGame" / "AgrarianCampfire.cpp": [
        "#include \"AgrarianGameState.h\"",
        "DeltaSeconds * GetWeatherFuelDrainMultiplier()",
        "bWetWeatherCanExtinguish && IsWetWeatherActive()",
        "WetWeatherExtinguishFuelThresholdSeconds",
        "Extinguish();",
        "case EAgrarianWeatherType::Rain:",
        "case EAgrarianWeatherType::Storm:",
        "World->GetGameState<AAgrarianGameState>()",
        "return EAgrarianWeatherType::Clear;",
    ],
    ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
        "- [x] Connect rain/weather to fire behavior.",
    ],
    ROOT / "Docs" / "TechnicalDesignDocument.md": [
        "Campfires now read the replicated `AAgrarianGameState::Weather` value",
    ],
}


def main():
    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("Campfire weather behavior verification failed:\n" + "\n".join(missing))

    print("PASS: campfire weather behavior is implemented and documented.")


if __name__ == "__main__":
    main()
