import { redirect } from 'next/navigation';
import { resolveUser } from '@/lib/auth';
import { MaintenanceQueue } from './maintenance-queue';

export default async function MaintenancePage() {
  // QCP users have no business in the maintenance queue (and the queue
  // procedure would 403 them) — send them to their quality console.
  const user = await resolveUser();
  if (user?.role === 'QUALITY') redirect('/quality');

  return <MaintenanceQueue />;
}
