import { auth } from '@/auth';
import { redirect } from 'next/navigation';
import { isSuperAdmin } from '@/lib/auth/roles';

export default async function Dashboard() {
  const session = await auth();

  if (!session?.user?.id) {
    redirect('/auth/sign-in');
  }

  if (isSuperAdmin(session.user.systemRole) && !session.user.activeOrganizationId) {
    redirect('/dashboard/organizers');
  }

  redirect('/dashboard/overview');
}
