import { AnalyticsApiClient } from '../../api/analytics/AnalyticsApiClient'; import { AnalyticsDashboardPresenter } from '../../presenters/AnalyticsDashboardPresenter'; import { AnalyticsMetricsPresenter } from '../../presenters/AnalyticsMetricsPresenter'; import type { AnalyticsDashboardViewModel, AnalyticsMetricsViewModel } from '../../view-models'; /** * Dashboard Service * * Orchestrates dashboard operations by coordinating API calls and presentation logic. * All dependencies are injected via constructor. */ export class DashboardService { constructor( private readonly apiClient: AnalyticsApiClient, private readonly analyticsDashboardPresenter: AnalyticsDashboardPresenter, private readonly analyticsMetricsPresenter: AnalyticsMetricsPresenter ) {} /** * Get dashboard data with presentation transformation */ async getDashboardData(): Promise { try { const dto = await this.apiClient.getDashboardData(); return this.analyticsDashboardPresenter.present(dto); } catch (error) { throw error; } } /** * Get analytics metrics with presentation transformation */ async getAnalyticsMetrics(): Promise { try { const dto = await this.apiClient.getAnalyticsMetrics(); return this.analyticsMetricsPresenter.present(dto); } catch (error) { throw error; } } /** * Get dashboard overview (legacy method for backward compatibility) * TODO: Remove when no longer needed */ async getDashboardOverview(): Promise { return this.getDashboardData(); } }