#!/usr/bin/env python3
"""Verify the MVP ambient biome audio attachment point is wired."""

from pathlib import Path


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


REQUIRED = {
    AUDIO_H: [
        "TObjectPtr<USoundBase> BiomeAmbientLoopSound;",
        "float BiomeAmbientDayVolume",
        "float BiomeAmbientNightVolume",
        "TObjectPtr<UAudioComponent> AmbientAudio;",
    ],
    AUDIO_CPP: [
        "BiomeAmbientLoopSound",
        "AmbientAudio->SetSound(BiomeAmbientLoopSound)",
        "FMath::Max(AmbientDayVolume, BiomeAmbientDayVolume)",
        "FMath::Max(AmbientNightVolume, BiomeAmbientNightVolume)",
    ],
    MAP_SETUP: [
        "AGR_DemoWeatherAudioController",
        "unreal.AgrarianWeatherAudioController",
    ],
    TDD: [
        "coastal-scrub biome bed",
        "`BiomeAmbientLoopSound`",
        "separate day and\nnight volume targets",
    ],
    ROADMAP: [
        "[x] Add ambient biome audio.",
    ],
}


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: ambient biome audio is wired through the placed weather audio controller.")


if __name__ == "__main__":
    main()
