import { CompleteOnboardingOutputDTO } from '../dtos/CompleteOnboardingOutputDTO';
import type { ICompleteDriverOnboardingPresenter, CompleteDriverOnboardingResultDTO } from '../../../../../core/racing/application/presenters/ICompleteDriverOnboardingPresenter';

export class CompleteOnboardingPresenter implements ICompleteDriverOnboardingPresenter {
  private result: CompleteOnboardingOutputDTO | null = null;

  reset() {
    this.result = null;
  }

  present(dto: CompleteDriverOnboardingResultDTO) {
    this.result = {
      success: dto.success,
      driverId: dto.driverId,
      errorMessage: dto.errorMessage,
    };
  }

  get viewModel(): CompleteOnboardingOutputDTO {
    if (!this.result) throw new Error('Presenter not presented');
    return this.result;
  }
}