import { redirect } from 'next/navigation';
import { auth } from '@/app/api/auth/[...nextauth]/route';
import { isAdmin } from '@/lib/permissions';
import { ManageUsersContent } from './ManageUsersContent';

export default async function ManageUsersPage() {
  const session = await auth();
  
  if (!session?.user) {
    redirect('/login?callbackUrl=/admin/users');
  }

  const admin = await isAdmin();
  if (!admin) {
    redirect('/');
  }

  return <ManageUsersContent />;
}

