// src/shared/constants/roles.ts
// Role constants for RBAC (Role-Based Access Control)

/**
 * User roles constant for RBAC
 */
export const USER_ROLES = {
  ADMIN: 'ADMIN',
  MANAGER: 'MANAGER',
  MAID: 'MAID',
  GOD: 'GOD',
} as const;

/**
 * Type for user role
 */
export type UserRole = typeof USER_ROLES[keyof typeof USER_ROLES];

/**
 * Array of all user roles
 */
export const ALL_ROLES: UserRole[] = Object.values(USER_ROLES);

/**
 * Staff roles - roles that can be mentioned and receive notifications
 * Excludes MAID role
 */
export const STAFF_ROLES: UserRole[] = [
  USER_ROLES.ADMIN,
  USER_ROLES.MANAGER,
  USER_ROLES.GOD,
];

/**
 * Privileged roles - roles with elevated permissions
 * Used for permission checks and UI filtering
 */
export const PRIVILEGED_ROLES: UserRole[] = [
  USER_ROLES.ADMIN,
  USER_ROLES.MANAGER,
  USER_ROLES.GOD,
];

/**
 * Check if a value is a valid user role
 */
export function isValidRole(role: string): role is UserRole {
  return ALL_ROLES.includes(role as UserRole);
}

/**
 * Check if a role is a staff role
 */
export function isStaffRole(role: UserRole): boolean {
  return STAFF_ROLES.includes(role);
}
