import type { SponsorsApiClient } from '../../api/sponsors/SponsorsApiClient'; import type { SponsorListPresenter } from '../../presenters/SponsorListPresenter'; import type { SponsorDashboardPresenter } from '../../presenters/SponsorDashboardPresenter'; import type { SponsorSponsorshipsPresenter } from '../../presenters/SponsorSponsorshipsPresenter'; import type { SponsorViewModel, SponsorDashboardViewModel, SponsorSponsorshipsViewModel } from '../../view-models'; import type { CreateSponsorInputDto, CreateSponsorOutputDto, GetEntitySponsorshipPricingResultDto } from '../../dtos'; /** * Sponsor Service * * Orchestrates sponsor operations by coordinating API calls and presentation logic. * All dependencies are injected via constructor. */ export class SponsorService { constructor( private readonly apiClient: SponsorsApiClient, private readonly sponsorListPresenter: SponsorListPresenter, private readonly sponsorDashboardPresenter: SponsorDashboardPresenter, private readonly sponsorSponsorshipsPresenter: SponsorSponsorshipsPresenter ) {} /** * Get all sponsors with presentation transformation */ async getAllSponsors(): Promise { const dto = await this.apiClient.getAll(); return this.sponsorListPresenter.present(dto); } /** * Get sponsor dashboard with presentation transformation */ async getSponsorDashboard(sponsorId: string): Promise { const dto = await this.apiClient.getDashboard(sponsorId); if (!dto) { return null; } return this.sponsorDashboardPresenter.present(dto); } /** * Get sponsor sponsorships with presentation transformation */ async getSponsorSponsorships(sponsorId: string): Promise { const dto = await this.apiClient.getSponsorships(sponsorId); if (!dto) { return null; } return this.sponsorSponsorshipsPresenter.present(dto); } /** * Create a new sponsor */ async createSponsor(input: CreateSponsorInputDto): Promise { return await this.apiClient.create(input); } /** * Get sponsorship pricing */ async getSponsorshipPricing(): Promise { return await this.apiClient.getPricing(); } }