import { Injectable } from '@angular/core';
import { SearchAnalyticsEvent } from '../models/search.model';

@Injectable({ providedIn: 'root' })
export class SearchAnalyticsService {
  buildEvent(input: {
    query: string;
    tenant: string;
    language: string;
    resultCount: number;
    timestamp?: string;
  }): SearchAnalyticsEvent {
    return {
      query: input.query,
      tenant: input.tenant,
      language: input.language,
      timestamp: input.timestamp ?? new Date().toISOString(),
      resultCount: input.resultCount,
    };
  }
}
