import { describe, it, expect } from 'vitest';
import { HomeDiscoveryViewModel } from './HomeDiscoveryViewModel';
import { LeagueCardViewModel } from './LeagueCardViewModel';
import { TeamCardViewModel } from './TeamCardViewModel';
import { UpcomingRaceCardViewModel } from './UpcomingRaceCardViewModel';

describe('HomeDiscoveryViewModel', () => {
  it('exposes the top leagues, teams and upcoming races from the DTO', () => {
    const topLeagues = [
      new LeagueCardViewModel({
        id: 'league-1',
        name: 'Pro League',
        description: 'Top-tier league',
        memberCount: 100,
        isMember: false,
      } as any),
    ];

    const teams = [
      new TeamCardViewModel({
        id: 'team-1',
        name: 'Team Alpha',
        tag: 'ALPHA',
        memberCount: 10,
        isMember: true,
      } as any),
    ];

    const upcomingRaces = [
      new UpcomingRaceCardViewModel({
        id: 'race-1',
        track: 'Spa-Francorchamps',
        car: 'GT3',
        scheduledAt: '2025-01-01T12:00:00Z',
      } as any),
    ];

    const viewModel = new HomeDiscoveryViewModel({
      topLeagues,
      teams,
      upcomingRaces,
    });

    expect(viewModel.topLeagues).toBe(topLeagues);
    expect(viewModel.teams).toBe(teams);
    expect(viewModel.upcomingRaces).toBe(upcomingRaces);
  });
});
