export type TrendType = 'up' | 'down' | 'flat';

export interface TrendData {
  trend: TrendType;
  percentage: number;
  isNegative?: boolean;
  isNew?: boolean; // When growing from 0 previous data
}

export interface AnalyticsSummary {
  totalScans: number;
  uniqueScans: number;
  avgScansPerQR: number;
  mobilePercentage: number;
  topCountry: string;
  topCountryPercentage: number;
  scansTrend?: TrendData;
  avgScansTrend?: TrendData;
  comparisonPeriod: 'week' | 'month';
  comparisonDays: number;
}

export interface CountryStats {
  country: string;
  count: number;
  percentage: number;
  trend: TrendType;
  trendPercentage: number;
  isNew?: boolean;
}

export interface QRPerformance {
  id: string;
  title: string;
  type: string;
  totalScans: number;
  uniqueScans: number;
  conversion: number;
  trend: TrendType;
  trendPercentage: number;
  isNew?: boolean;
}

export interface AnalyticsResponse {
  summary: AnalyticsSummary;
  deviceStats: Record<string, number>;
  countryStats: CountryStats[];
  dailyScans: Record<string, number>;
  qrPerformance: QRPerformance[];
}
