import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
import type { JoinLeagueResult } from '@core/racing/application/use-cases/JoinLeagueUseCase';
import type { JoinLeagueOutputDTO } from '../dtos/JoinLeagueOutputDTO';

export class JoinLeaguePresenter implements UseCaseOutputPort<JoinLeagueResult> {
  private result: JoinLeagueOutputDTO | null = null;

  reset() {
    this.result = null;
  }

  present(result: JoinLeagueResult): void {
    this.result = {
      success: true,
      membershipId: result.membership.id.toString(),
    };
  }

  getViewModel(): JoinLeagueOutputDTO | null {
    return this.result;
  }
}