import { UserRole } from '@/shared/types/app';

/** Fallback UI role when the backend role name is missing/unrecognized. */
export const DEFAULT_PRODUCT_ROLE: UserRole = 'teacher';

/** All role names the backend may send as `app_role.name`. */
export const USER_ROLE_VALUES: readonly UserRole[] = [
  'super_admin',
  'system_admin',
  'owner',
  'superintendent',
  'director',
  'office_manager',
  'teacher',
  'support_staff',
  'student',
  'guardian',
  'guest',
];

export function isUserRole(value: string | null | undefined): value is UserRole {
  return value != null && (USER_ROLE_VALUES as readonly string[]).includes(value);
}
