import { redirect } from 'next/navigation';
import { getCurrentAdmin } from '@/lib/actions/auth';
import NavigationShell from '@/components/NavigationShell';

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

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

  return (
    <NavigationShell user={user}>
      {children}
    </NavigationShell>
  );
}
