import { StewardingApiDto } from '@/lib/types/tbd/StewardingApiDto';
import { StewardingViewData } from '@/lib/view-data/leagues/StewardingViewData';


export class StewardingViewDataBuilder {
  static build(apiDto: StewardingApiDto): StewardingViewData {
    return {
      leagueId: apiDto.leagueId,
      totalPending: apiDto.totalPending || 0,
      totalResolved: apiDto.totalResolved || 0,
      totalPenalties: apiDto.totalPenalties || 0,
      races: (apiDto.races || []).map((race) => ({
        id: race.id,
        track: race.track,
        scheduledAt: race.scheduledAt,
        pendingProtests: race.pendingProtests || [],
        resolvedProtests: race.resolvedProtests || [],
        penalties: race.penalties || [],
      })),
      drivers: (apiDto.drivers || []).map((driver) => ({
        id: driver.id,
        name: driver.name,
      })),
    };
  }
}