from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
FILES = {
    "AgrarianDebugHUD.h": ROOT / "Source" / "AgrarianGame" / "AgrarianDebugHUD.h",
    "AgrarianDebugHUD.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianDebugHUD.cpp",
    "InventoryDataModel.md": ROOT / "Docs" / "InventoryDataModel.md",
    "TechnicalDesignDocument.md": ROOT / "Docs" / "TechnicalDesignDocument.md",
    "AGRARIAN_DEVELOPMENT_ROADMAP.md": ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md",
}

EXPECTED = {
    "AgrarianDebugHUD.h": [
        "bShowInventoryHUD",
        "InventoryTextScale",
        "MaxInventoryPanelRows",
        "DrawInventoryPanel",
    ],
    "AgrarianDebugHUD.cpp": [
        "DrawInventoryPanel(AgrarianCharacter)",
        "AAgrarianDebugHUD::DrawInventoryPanel",
        "InventoryComponent->Items.Num()",
        "InventoryComponent->MaxSlots",
        "InventoryComponent->GetTotalWeight()",
        "MaxInventoryPanelRows",
        "Stack.UnitWeight * Stack.Quantity",
    ],
    "InventoryDataModel.md": [
        "compact inventory panel",
        "occupied slots",
        "total carried weight",
        "visible item stacks",
    ],
    "TechnicalDesignDocument.md": [
        "The MVP inventory UI is a compact `AAgrarianDebugHUD` inventory panel",
        "enabled",
        "separately from the full developer HUD",
        "shows occupied slots",
        "total carried weight",
        "server-authoritative commands",
    ],
    "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
        "[x] Add inventory UI.",
        "compact MVP HUD inventory panel",
        "replicated inventory component",
    ],
}


def main():
    missing = []
    for label, path in FILES.items():
        text = path.read_text(encoding="utf-8")
        for snippet in EXPECTED[label]:
            if snippet not in text:
                missing.append(f"{label}: {snippet}")

    if missing:
        raise RuntimeError("Inventory UI verification failed: " + "; ".join(missing))

    print("Agrarian inventory UI verification complete.")


if __name__ == "__main__":
    main()
