import { getCurrentUser } from '@/lib/auth';
import { redirect } from 'next/navigation';
import Navigation from './navigation';

export default async function MainLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const user = await getCurrentUser();

  if (!user) {
    redirect('/auth/login');
  }

  return (
    <div className="min-h-screen flex flex-col bg-[#0A0A0A]">
      <Navigation userName={user.name || user.email || 'User'} />
      <main className="flex-1 app-content pb-20 md:pb-0">
        {children}
      </main>
    </div>
  );
}
