from pathlib import Path


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

EXPECTED = {
    ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.h": [
        "void AgrarianCraft(FName RecipeId);",
        "void AgrarianCraftStatus();",
        "void ServerAgrarianCraft(FName RecipeId);",
    ],
    ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp": [
        "#include \"AgrarianCraftingComponent.h\"",
        "void AAgrarianGamePlayerController::AgrarianCraft(FName RecipeId)",
        "void AAgrarianGamePlayerController::AgrarianCraftStatus()",
        "CraftingComponent->GetKnownRecipes(Recipes)",
        "CraftingComponent->CanCraft(Recipe.RecipeId, FailureReason)",
        "void AAgrarianGamePlayerController::ServerAgrarianCraft_Implementation(FName RecipeId)",
        "CraftingComponent->Craft(RecipeId)",
    ],
    ROOT / "Docs" / "TechnicalDesignDocument.md": [
        "`AgrarianCraft <RecipeId>`",
        "`AgrarianCraftStatus`",
    ],
    ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
        "- [x] Add crafting debug tools.",
        "AgrarianCraftStatus",
    ],
}


def main():
    missing = []
    for path, snippets in EXPECTED.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 RuntimeError("Crafting debug tools verification failed: " + "; ".join(missing))

    print("PASS: crafting debug exec tools are wired and documented.")


if __name__ == "__main__":
    main()
