import { redirect } from 'next/navigation';
import { getAdminUser } from '@/lib/auth/admin';
import { AdminShell } from './admin-shell';

export default async function AdminLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const user = await getAdminUser();
  if (!user) {
    redirect('/auth/login');
  }

  return <AdminShell user={user}>{children}</AdminShell>;
}
