import { LeagueMembershipService } from './services/leagues/LeagueMembershipService';

/**
 * Get membership for a driver in a league
 */
export function getMembership(leagueId: string, driverId: string) {
  return LeagueMembershipService.getMembership(leagueId, driverId);
}

/**
 * Get all members of a league
 */
export function getLeagueMembers(leagueId: string) {
  return LeagueMembershipService.getLeagueMembers(leagueId);
}

/**
 * Get primary league ID for a driver (first league they joined)
 */
export function getPrimaryLeagueIdForDriver(driverId: string): string | null {
  const memberships = LeagueMembershipService.getAllMembershipsForDriver(driverId);
  if (memberships.length === 0) return null;
  return memberships[0].leagueId;
}