const PRIVILEGED_PAYROLL_ROLE_NAMES = new Set([
  'Administrator',
  'System Owner',
  'Payroll Manager',
  'Operations Manager',
]);

const BLOCKED_WORKER_ROUTE_PREFIXES = ['/users', '/pay_types', '/employee_pay_types'];

export function isRestrictedPayrollUser(user: any) {
  if (!user?.id) {
    return false;
  }

  return !PRIVILEGED_PAYROLL_ROLE_NAMES.has(user?.app_role?.name);
}

export function isBlockedWorkerRoute(pathname?: string) {
  if (!pathname) {
    return false;
  }

  return BLOCKED_WORKER_ROUTE_PREFIXES.some((prefix) => pathname.startsWith(prefix));
}
