import type { IStandingRepository } from '../../domain/repositories/IStandingRepository'; import type { ILeagueStandingsPresenter, LeagueStandingsResultDTO, LeagueStandingsViewModel, } from '../presenters/ILeagueStandingsPresenter'; import type { UseCase } from '@gridpilot/shared/application/UseCase'; export interface GetLeagueStandingsUseCaseParams { leagueId: string; } /** * Use Case for retrieving league standings. * Orchestrates domain logic and delegates presentation to the presenter. */ export class GetLeagueStandingsUseCase implements UseCase { constructor(private readonly standingRepository: IStandingRepository) {} async execute( params: GetLeagueStandingsUseCaseParams, presenter: ILeagueStandingsPresenter, ): Promise { const standings = await this.standingRepository.findByLeagueId(params.leagueId); const dto: LeagueStandingsResultDTO = { standings, }; presenter.reset(); presenter.present(dto); } }