from pathlib import Path


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

EXPECTED = {
    "AgrarianGamePlayerController.h": [
        "void AgrarianTravel(float X, float Y, float Z);",
        "void AgrarianTravelHome();",
        "void ServerAgrarianTravel(FVector Destination);",
    ],
    "AgrarianGamePlayerController.cpp": [
        "GroundZeroDeveloperTravelHomeLocation(-22000.0f, -3500.0f, 1148.0f)",
        "void AAgrarianGamePlayerController::AgrarianTravel(float X, float Y, float Z)",
        "void AAgrarianGamePlayerController::AgrarianTravelHome()",
        "ServerAgrarianTravel(FVector(X, Y, Z));",
        "void AAgrarianGamePlayerController::ServerAgrarianTravel_Implementation(FVector Destination)",
        "ControlledPawn->TeleportTo(Destination, ControlledPawn->GetActorRotation(), false, true);",
        "Movement->StopMovementImmediately();",
        "Destination.ContainsNaN()",
    ],
    "TechnicalDesignDocument.md": [
        "`AgrarianTravel X Y Z`",
        "`AgrarianTravelHome`",
        "server-authoritative developer travel",
    ],
    "AGRARIAN_DEVELOPMENT_ROADMAP.md": [
        "[x] Add developer travel command.",
    ],
}


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("Developer travel command verification failed: " + "; ".join(missing))

    print("Agrarian developer travel command verification complete.")


if __name__ == "__main__":
    main()
