import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
import type { ListLeagueScoringPresetsResult } from '@core/racing/application/use-cases/ListLeagueScoringPresetsUseCase';
import type { LeagueScoringPresetsDTO } from '../dtos/LeagueScoringPresetsDTO';

export type LeagueScoringPresetsViewModel = LeagueScoringPresetsDTO;

export class LeagueScoringPresetsPresenter implements UseCaseOutputPort<ListLeagueScoringPresetsResult> {
  private viewModel: LeagueScoringPresetsViewModel | null = null;

  reset(): void {
    this.viewModel = null;
  }

  present(result: ListLeagueScoringPresetsResult): void {
    this.viewModel = {
      presets: result.presets,
      totalCount: result.presets.length,
    };
  }

  getViewModel(): LeagueScoringPresetsViewModel | null {
    return this.viewModel;
  }
}