import { requireAuth } from "@/lib/session";
import { db } from "@/lib/db";
import GoldenCardsClient from "./GoldenCardsClient";

export default async function GoldenCardsPage() {
  const session = await requireAuth();
  const userId = (session.user as any).id;

  const cards = await db.goldenCard.findMany({
    where: { userId },
    include: { player: { include: { country: true } } },
    orderBy: { acquiredDate: "desc" },
  });

  return (
    <div className="min-h-screen bg-gray-950 text-white py-10 px-4">
      <GoldenCardsClient initialCards={cards as any} />
    </div>
  );
}
