import { redirect } from "next/navigation";
import { getSession } from "@/lib/auth-utils";
import { ProfileForm } from "@/components/settings/profile-form";
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card";
import { PageHeader } from "@/components/navigation/page-header";

export default async function SettingsPage() {
  const session = await getSession();

  if (!session) {
    redirect("/auth/sign-in");
  }

  return (
    <>
      <PageHeader
        title="Settings"
        description="Manage your account settings"
        breadcrumbs={[{ label: "Settings" }]}
        accent
      />
      <div className="container mx-auto px-6 py-6 max-w-2xl">
        <Card>
          <CardHeader>
            <CardTitle>Profile</CardTitle>
            <CardDescription>Update your personal information</CardDescription>
          </CardHeader>
          <CardContent>
            <ProfileForm user={session.user} />
          </CardContent>
        </Card>
      </div>
    </>
  );
}
