import { PaymentsApiClient } from '../../api/payments/PaymentsApiClient';
import { presentMembershipFee } from '../../presenters/MembershipFeePresenter';
import type { MembershipFeeViewModel } from '../../view-models';

/**
 * Membership Fee Service
 *
 * Orchestrates membership fee operations by coordinating API calls and presentation logic.
 * All dependencies are injected via constructor.
 */
export class MembershipFeeService {
  constructor(
    private readonly apiClient: PaymentsApiClient
  ) {}

  /**
   * Get membership fees by league ID with presentation transformation
   */
  async getMembershipFees(leagueId: string): Promise<MembershipFeeViewModel[]> {
    try {
      const dto = await this.apiClient.getMembershipFees(leagueId);
      return dto.fees.map(presentMembershipFee);
    } catch (error) {
      throw error;
    }
  }
}