import { AnalyticsApiClient } from '../../api/analytics/AnalyticsApiClient'; import { RecordPageViewOutputViewModel } from '../../view-models/RecordPageViewOutputViewModel'; import { RecordEngagementOutputViewModel } from '../../view-models/RecordEngagementOutputViewModel'; // TODO: Create proper DTOs in generated types interface RecordPageViewInputDTO { path: string; userId?: string; } interface RecordEngagementInputDTO { eventType: string; userId?: string; metadata?: Record; } /** * Analytics Service * * Orchestrates analytics operations by coordinating API calls. * All dependencies are injected via constructor. */ export class AnalyticsService { constructor( private readonly apiClient: AnalyticsApiClient ) {} /** * Record a page view */ async recordPageView(input: RecordPageViewInputDTO): Promise { const result = await this.apiClient.recordPageView(input); return new RecordPageViewOutputViewModel(result); } /** * Record an engagement event */ async recordEngagement(input: RecordEngagementInputDTO): Promise { const result = await this.apiClient.recordEngagement(input); return new RecordEngagementOutputViewModel(result); } }