import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';

import type {
    CreateLeagueScheduleRaceOutputDTO,
    LeagueScheduleRaceMutationSuccessDTO,
} from '../dtos/LeagueScheduleRaceAdminDTO';
import type { LeagueSeasonSchedulePublishOutputDTO } from '../dtos/LeagueSeasonSchedulePublishDTO';

import type { CreateLeagueSeasonScheduleRaceResult } from '@core/racing/application/use-cases/CreateLeagueSeasonScheduleRaceUseCase';
import type { DeleteLeagueSeasonScheduleRaceResult } from '@core/racing/application/use-cases/DeleteLeagueSeasonScheduleRaceUseCase';
import type { PublishLeagueSeasonScheduleResult } from '@core/racing/application/use-cases/PublishLeagueSeasonScheduleUseCase';
import type { UnpublishLeagueSeasonScheduleResult } from '@core/racing/application/use-cases/UnpublishLeagueSeasonScheduleUseCase';
import type { UpdateLeagueSeasonScheduleRaceResult } from '@core/racing/application/use-cases/UpdateLeagueSeasonScheduleRaceUseCase';

export class CreateLeagueSeasonScheduleRacePresenter
  implements UseCaseOutputPort<CreateLeagueSeasonScheduleRaceResult>
{
  private responseModel: CreateLeagueScheduleRaceOutputDTO | null = null;

  present(result: CreateLeagueSeasonScheduleRaceResult): void {
    this.responseModel = { raceId: result.raceId };
  }

  getResponseModel(): CreateLeagueScheduleRaceOutputDTO | null {
    return this.responseModel;
  }

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

export class UpdateLeagueSeasonScheduleRacePresenter
  implements UseCaseOutputPort<UpdateLeagueSeasonScheduleRaceResult>
{
  private responseModel: LeagueScheduleRaceMutationSuccessDTO | null = null;

  present(result: UpdateLeagueSeasonScheduleRaceResult): void {
    void result;
    this.responseModel = { success: true };
  }

  getResponseModel(): LeagueScheduleRaceMutationSuccessDTO | null {
    return this.responseModel;
  }

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

export class DeleteLeagueSeasonScheduleRacePresenter
  implements UseCaseOutputPort<DeleteLeagueSeasonScheduleRaceResult>
{
  private responseModel: LeagueScheduleRaceMutationSuccessDTO | null = null;

  present(result: DeleteLeagueSeasonScheduleRaceResult): void {
    void result;
    this.responseModel = { success: true };
  }

  getResponseModel(): LeagueScheduleRaceMutationSuccessDTO | null {
    return this.responseModel;
  }

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

export class PublishLeagueSeasonSchedulePresenter
  implements UseCaseOutputPort<PublishLeagueSeasonScheduleResult>
{
  private responseModel: LeagueSeasonSchedulePublishOutputDTO | null = null;

  present(result: PublishLeagueSeasonScheduleResult): void {
    this.responseModel = { success: true, published: result.published };
  }

  getResponseModel(): LeagueSeasonSchedulePublishOutputDTO | null {
    return this.responseModel;
  }

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

export class UnpublishLeagueSeasonSchedulePresenter
  implements UseCaseOutputPort<UnpublishLeagueSeasonScheduleResult>
{
  private responseModel: LeagueSeasonSchedulePublishOutputDTO | null = null;

  present(result: UnpublishLeagueSeasonScheduleResult): void {
    this.responseModel = { success: true, published: result.published };
  }

  getResponseModel(): LeagueSeasonSchedulePublishOutputDTO | null {
    return this.responseModel;
  }

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