import { redirect } from "next/navigation";
import { getCurrentUser } from "@/lib/auth-utils";
import { BookingsContent } from "./bookings-content";

export const metadata = {
  title: "My Bookings | ZuriGuide",
  description: "View and manage your tour bookings",
};

export default async function BookingsPage() {
  const user = await getCurrentUser();

  if (!user) {
    redirect("/login");
  }

  return (
    <div className="min-h-screen bg-background">
      <div className="container mx-auto px-4 py-8">
        <div className="max-w-4xl mx-auto">
          <div className="mb-8">
            <h1 className="text-3xl font-bold mb-2">My Bookings</h1>
            <p className="text-muted-foreground">
              View and manage your tour bookings
            </p>
          </div>

          <BookingsContent userId={user.id} />
        </div>
      </div>
    </div>
  );
}
