/**
 * Role Hierarchy Configuration
 *
 * Business logic configuration for league role ordering and permissions
 */

export type LeagueMembershipRole = 'owner' | 'admin' | 'steward' | 'member';

export const roleOrder: Record<LeagueMembershipRole, number> = {
  owner: 0,
  admin: 1,
  steward: 2,
  member: 3,
};

export const getRoleOrder = (role: LeagueMembershipRole): number => {
  return roleOrder[role] ?? 99;
};

export const isLeagueAdminOrHigherRole = (role: LeagueMembershipRole): boolean => {
  return role === 'owner' || role === 'admin' || role === 'steward';
};

export const roleHierarchy = {
  roleOrder,
  getRoleOrder,
  isLeagueAdminOrHigherRole,
} as const;