import { ViewModel } from "../contracts/view-models/ViewModel"; import type { LeagueScheduleViewData } from "../view-data/LeagueScheduleViewData"; import { LeagueScheduleRaceViewModel } from "./LeagueScheduleRaceViewModel"; export { LeagueScheduleRaceViewModel }; export class LeagueScheduleViewModel extends ViewModel { readonly races: LeagueScheduleRaceViewModel[]; constructor(data: LeagueScheduleViewData) { super(); this.races = data.races.map((r: any) => new LeagueScheduleRaceViewModel(r)); } get raceCount(): number { return this.races.length; } get hasRaces(): boolean { return this.raceCount > 0; } }