import type { GetLeagueAdminPermissionsResult } from '@core/racing/application/use-cases/GetLeagueAdminPermissionsUseCase';
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
import { LeagueAdminPermissionsDTO } from '../dtos/LeagueAdminPermissionsDTO';

export class GetLeagueAdminPermissionsPresenter implements UseCaseOutputPort<GetLeagueAdminPermissionsResult> {
  private result: LeagueAdminPermissionsDTO | null = null;

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

  present(port: GetLeagueAdminPermissionsResult): void {
    this.result = {
      canRemoveMember: port.permissions.canManageMembers,
      canUpdateRoles: port.permissions.canManageMembers,
    };
  }

  getResponseModel(): LeagueAdminPermissionsDTO | null {
    return this.result;
  }
}
