export type AdminAnalyticsDateRange = 7 | 30 | 90;

export interface AdminAnalyticsSummary {
  revenueTotal: number;
  currency: string;
  ordersCount: number;
  avgOrderValue: number;
  productsCount: number;
  categoriesCount: number;
  customersCount: number;
  /** null = unknown - no visitor/traffic tracking exists yet. Never fabricated. */
  conversionRate: number | null;
}

export interface AdminAnalyticsSeriesPoint {
  date: string;
  value: number;
}

export interface AdminAnalyticsTopProduct {
  productId: string;
  name: string;
  quantity: number;
  revenue: number;
}

export interface AdminLowStockProduct {
  productId: string;
  name: string;
  quantity: number;
  stockStatus: 'low_stock' | 'out_of_stock';
}

export interface AdminRecentActivityEntry {
  id: string;
  labelKey: string;
  timestamp: number;
}

export type AdminMarketplaceHealthStatus = 'healthy' | 'attention' | 'unhealthy' | 'unknown';

export interface AdminMarketplaceHealthCheck {
  code: string;
  labelKey: string;
  status: AdminMarketplaceHealthStatus;
  displayValue?: string | null;
  actionRoute?: string[];
}

export interface AdminProductAnalyticsRow {
  productId: string;
  name: string;
  value: number;
}

export interface AdminProductAnalytics {
  topSelling: AdminAnalyticsTopProduct[];
  mostReviewed: AdminProductAnalyticsRow[];
  worstRated: AdminProductAnalyticsRow[];
  hiddenCount: number;
  archivedCount: number;
}

export interface AdminCustomerAnalytics {
  newCustomers: number;
  returningCustomers: number;
  averageSpend: number;
  currency: string;
  /** null = unknown when there are no customers in range to compute a rate from. */
  retentionPercent: number | null;
}

export type AdminRecommendationSeverity = 'info' | 'warning' | 'critical';

export interface AdminRecommendationCard {
  id: string;
  labelKey: string;
  descriptionKey?: string;
  severity: AdminRecommendationSeverity;
  route: string[];
}
