#!/usr/bin/env python3
"""Verify MVP weather sound hooks are documented and map-placed."""

from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
DOC = ROOT / "Docs" / "Audio" / "WeatherSounds.md"
AUDIO_H = ROOT / "Source" / "AgrarianGame" / "AgrarianWeatherAudioController.h"
AUDIO_CPP = ROOT / "Source" / "AgrarianGame" / "AgrarianWeatherAudioController.cpp"
MAP_SETUP = ROOT / "Scripts" / "setup_ground_zero_demo_map.py"
ROADMAP = ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md"

REQUIRED = {
    DOC: [
        "`AAgrarianWeatherAudioController`",
        "`RainLoopSound`",
        "`WindLoopSound`",
        "`StormLoopSound`",
        "`ClearAmbientSound`",
        "`BiomeAmbientLoopSound`",
        "provider wind speed",
        "day/night state",
    ],
    AUDIO_H: [
        "TObjectPtr<USoundBase> RainLoopSound;",
        "TObjectPtr<USoundBase> WindLoopSound;",
        "TObjectPtr<USoundBase> StormLoopSound;",
    ],
    AUDIO_CPP: [
        "GameState->Weather",
        "GameState->ActiveWeatherInputs.WindSpeedKmh",
        "ApplyComponentVolume(RainAudio, CurrentRainVolume);",
        "ApplyComponentVolume(WindAudio, CurrentWindVolume);",
        "ApplyComponentVolume(StormAudio, CurrentStormVolume);",
    ],
    MAP_SETUP: [
        "AGR_DemoWeatherAudioController",
        "unreal.AgrarianWeatherAudioController",
    ],
    ROADMAP: [
        "[x] Add weather sounds.",
    ],
}


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: weather sound hooks are documented and map-placed.")


if __name__ == "__main__":
    main()
