#!/usr/bin/env python3
"""Verify 0.1.O readable survival-object proxy coverage."""

from __future__ import annotations

from pathlib import Path


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


REQUIRED_SNIPPETS = {
    "Source/AgrarianGame/AgrarianCampfire.h": [
        "StoneRingProxy",
        "LogProxyA",
        "LogProxyB",
        "LogProxyC",
        "EmberProxy",
    ],
    "Source/AgrarianGame/AgrarianCampfire.cpp": [
        "SM_AGR_Placeholder_Cylinder",
        "M_AGR_GZ_Wood_Resource",
        "M_AGR_GZ_Stone_Sandstone",
        "ConfigureCampfireProxyComponent",
        "LogProxyA->SetRelativeRotation",
    ],
    "Source/AgrarianGame/AgrarianShelterActor.h": [
        "FloorProxy",
        "BackWallProxy",
        "LeftRoofProxy",
        "RightRoofProxy",
        "FrameProxyA",
        "FrameProxyB",
    ],
    "Source/AgrarianGame/AgrarianShelterActor.cpp": [
        "SM_AGR_Placeholder_ChamferCube",
        "M_AGR_GZ_Fiber_Resource",
        "LeftRoofProxy->SetRelativeRotation",
        "ConfigureShelterProxyComponent",
    ],
    "Source/AgrarianGame/AgrarianWaterSource.h": [
        "WaterSurfaceProxy",
        "StoneBankProxy",
        "CollectMarkerProxy",
    ],
    "Source/AgrarianGame/AgrarianWaterSource.cpp": [
        "SM_AGR_Placeholder_Plane",
        "M_AGR_GZ_FreshWater",
        "WaterSurfaceProxy->SetCollisionEnabled(ECollisionEnabled::NoCollision)",
        "StoneBankProxy->SetCollisionEnabled(ECollisionEnabled::NoCollision)",
    ],
    "Source/AgrarianGame/AgrarianItemPickup.h": [
        "BundleProxy",
        "StrapProxy",
        "ItemMarkerProxy",
    ],
    "Source/AgrarianGame/AgrarianItemPickup.cpp": [
        "BundleProxy->SetRelativeRotation",
        "StrapProxy->SetCollisionEnabled(ECollisionEnabled::NoCollision)",
        "ItemMarkerProxy->SetCollisionEnabled(ECollisionEnabled::NoCollision)",
    ],
    "Source/AgrarianGame/AgrarianResourceNode.h": [
        "ResourceClusterProxy",
        "HarvestableMarkerProxy",
    ],
    "Source/AgrarianGame/AgrarianResourceNode.cpp": [
        "ResourceClusterProxy->SetRelativeRotation",
        "HarvestableMarkerProxy->SetCollisionEnabled(ECollisionEnabled::NoCollision)",
        "Mesh->SetVisibility(RemainingHarvests > 0, true)",
    ],
    "Source/AgrarianGame/AgrarianWildlifeBase.h": [
        "WildlifeBodyProxy",
        "WildlifeHeadProxy",
        "WildlifeEarProxyA",
        "WildlifeEarProxyB",
        "WildlifeTailProxy",
    ],
    "Source/AgrarianGame/AgrarianWildlifeBase.cpp": [
        "WildlifeBodyProxy->SetupAttachment(RootComponent)",
        "WildlifeHeadProxy->SetupAttachment(WildlifeBodyProxy)",
        "WildlifeTailProxy->SetRelativeRotation",
        "ConfigureWildlifeProxyComponent",
    ],
    "Docs/CharactersAndObjects/MvpReadableSurvivalObjectProxies.md": [
        "MVP Readable Survival Object Proxies",
        "no collision",
        "Final realistic art should replace these proxies",
    ],
    "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
        "- [x] Replace box/sphere/cylinder survival objects with readable MVP meshes",
        "Added composed native proxy visuals for campfires, primitive shelters, pickups, resource nodes, water sources, and wildlife",
    ],
}


def main() -> int:
    missing: list[str] = []
    for relative_path, snippets in REQUIRED_SNIPPETS.items():
        path = ROOT / relative_path
        if not path.exists():
            missing.append(f"{relative_path}: file missing")
            continue

        text = path.read_text(encoding="utf-8")
        for snippet in snippets:
            if snippet not in text:
                missing.append(f"{relative_path}: missing {snippet!r}")

    if missing:
        print("Readable survival-object proxy verification failed:")
        for item in missing:
            print(f"- {item}")
        return 1

    print("Readable survival-object proxy verification passed.")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
