import { NextResponse } from 'next/server';

import { requireSuperAdmin, withAuth } from '@/lib/api/helpers';
import { errorResponse } from '@/lib/errors';
import { getQueueDashboard } from '@/lib/services/system-monitoring.service';

export const GET = withAuth(async (_req, ctx) => {
  try {
    requireSuperAdmin(ctx, 'admin.queues.list');

    const queues = await getQueueDashboard();
    return NextResponse.json({ data: queues });
  } catch (error) {
    return errorResponse(error);
  }
});
