import type { LeagueConfigFormModel } from '@/lib/types/LeagueConfigFormModel';
import type { LeagueScoringPresetDTO } from '@/lib/types/generated/LeagueScoringPresetDTO';
import { LeagueScoringPresetsViewModel } from './LeagueScoringPresetsViewModel';
import { DriverSummaryViewModel } from './DriverSummaryViewModel';

/**
 * View Model for league settings page
 * Combines league config, presets, owner, and members
 */
export class LeagueSettingsViewModel {
  league: {
    id: string;
    name: string;
    ownerId: string;
  };
  config: LeagueConfigFormModel;
  presets: LeagueScoringPresetDTO[];
  owner: DriverSummaryViewModel | null;
  members: DriverSummaryViewModel[];

  constructor(dto: {
    league: {
      id: string;
      name: string;
      ownerId: string;
      createdAt: string;
    };
    config: LeagueConfigFormModel;
    presets: LeagueScoringPresetDTO[];
    owner: DriverSummaryViewModel | null;
    members: DriverSummaryViewModel[];
  }) {
    this.league = dto.league;
    this.config = dto.config;
    this.presets = dto.presets;
    this.owner = dto.owner;
    this.members = dto.members;
  }
}