import { headers } from "next/headers";
import { auth } from "@/lib/auth/server";
import { SettingsSidebar } from "@/components/settings/settings-sidebar";
import { getMessages } from "@/lib/i18n/server";

export default async function SettingsLayout({ children }: { children: React.ReactNode }) {
  const session = await auth.api.getSession({ headers: await headers() });
  const m = getMessages((session?.user as { locale?: string })?.locale);

  return (
    <div className="max-w-5xl mx-auto">
      <div className="mb-8">
        <h1 className="text-3xl font-bold tracking-tight">{m.settings.title}</h1>
        <p className="text-muted-foreground mt-1">{m.settings.subtitle}</p>
      </div>
      <div className="flex gap-8 items-start">
        <SettingsSidebar />
        <main className="flex-1 min-w-0 space-y-6">{children}</main>
      </div>
    </div>
  );
}
