import { AnalyticsDashboardViewModel } from '@/lib/view-models/AnalyticsDashboardViewModel';
import { AnalyticsMetricsViewModel } from '@/lib/view-models/AnalyticsMetricsViewModel';
import { AnalyticsApiClient } from '../../api/analytics/AnalyticsApiClient';

/**
 * Dashboard Service
 *
 * Orchestrates dashboard operations by coordinating API calls and view model creation.
 * All dependencies are injected via constructor.
 */
export class DashboardService {
  constructor(
    private readonly apiClient: AnalyticsApiClient
  ) {}

  /**
   * Get dashboard data with view model transformation
   */
  async getDashboardData(): Promise<AnalyticsDashboardViewModel> {
    const dto = await this.apiClient.getDashboardData();
    return new AnalyticsDashboardViewModel(dto);
  }

  /**
   * Get analytics metrics with view model transformation
   */
  async getAnalyticsMetrics(): Promise<AnalyticsMetricsViewModel> {
    const dto = await this.apiClient.getAnalyticsMetrics();
    return new AnalyticsMetricsViewModel(dto);
  }
}