import { LeagueSponsorshipsViewData } from '@/lib/view-data/leagues/LeagueSponsorshipsViewData';
import { LeagueSponsorshipsApiDto } from '@/lib/types/tbd/LeagueSponsorshipsApiDto';
import { DateDisplay } from '@/lib/display-objects/DateDisplay';
import { StatusDisplay } from '@/lib/display-objects/StatusDisplay';

export class LeagueSponsorshipsViewDataBuilder {
  static build(apiDto: LeagueSponsorshipsApiDto): LeagueSponsorshipsViewData {
    return {
      leagueId: apiDto.leagueId,
      activeTab: 'overview',
      onTabChange: () => {},
      league: apiDto.league,
      sponsorshipSlots: apiDto.sponsorshipSlots,
      sponsorshipRequests: apiDto.sponsorshipRequests.map(r => ({
        ...r,
        formattedRequestedAt: DateDisplay.formatShort(r.requestedAt),
        statusLabel: StatusDisplay.protestStatus(r.status), // Reusing protest status for now
      })),
    };
  }
}
