import type { AllLeaguesWithCapacityDto } from '../dtos';
import { LeagueSummaryViewModel } from '../view-models';

/**
 * League Summary Presenter
 * Transforms AllLeaguesWithCapacityDto to array of LeagueSummaryViewModel
 */
export class LeagueSummaryPresenter {
  present(dto: AllLeaguesWithCapacityDto): LeagueSummaryViewModel[] {
    return dto.leagues.map(league => new LeagueSummaryViewModel(league));
  }
}

// Legacy functional exports for backward compatibility
export const presentLeagueSummary = (dto: any): LeagueSummaryViewModel => {
  return new LeagueSummaryViewModel(dto);
};

export const presentLeagueSummaries = (dtos: any[]): LeagueSummaryViewModel[] => {
  return dtos.map(presentLeagueSummary);
};