import { redirect } from "next/navigation";
import { auth } from "@/lib/auth";
import { getMessages } from "next-intl/server";
import { NextIntlClientProvider } from "next-intl";
import { ProfileCard } from "@/components/auth/ProfileCard";

export default async function ProfilePage({
  params,
}: {
  params: Promise<{ locale: string }>;
}) {
  const { locale } = await params;
  const session = await auth();

  if (!session?.user) {
    redirect(`/${locale}/login`);
  }

  const messages = await getMessages();

  return (
    <NextIntlClientProvider messages={messages} locale={locale}>
      <div className="min-h-screen bg-[#0a0a0f] px-4 py-12">
        <div className="max-w-2xl mx-auto">
          <ProfileCard user={session.user} />
        </div>
      </div>
    </NextIntlClientProvider>
  );
}
