import type {
  BusinessAlert,
  CommerceFilterState,
  ForecastDataPoint,
  FunnelStage,
  HeatmapCell,
  MetricCardData,
  PaymentBreakdownItem,
  TopProductRow,
} from '../types/commerce';

export const COMMERCE_KPIS: Record<string, MetricCardData> = {
  revenue: {title: 'Total Revenue', value: '₹3,40,000', change: '+14.2% vs prev', trendDirection: 'up', subtitle: 'Net revenue across active stores'},
  orders: {title: 'Total Orders', value: '1,284', change: '+8.5%', trendDirection: 'up', subtitle: 'Completed order volume'},
  aov: {title: 'Average Order Value', value: '₹1,420', change: '+5.1%', trendDirection: 'up', subtitle: 'Average spend per cart'},
  netSales: {title: 'Net Sales', value: '₹3,18,000', change: '+13.9%', trendDirection: 'up', subtitle: 'Revenue after discounts'},
  refunds: {title: 'Refunds & Returns', value: '₹22,000', change: '-2.4%', trendDirection: 'down', subtitle: '6.4% total return rate'},
  conversion: {title: 'Store Conversion', value: '23.8%', change: '+1.4%', trendDirection: 'up', subtitle: 'Visits to purchase ratio'},
  topStore: {title: 'Top Performing Store', value: 'Indiranagar Flagship', change: '+18.4%', trendDirection: 'up', subtitle: '₹9.1L Revenue (23.8% Conv)'},
};

export const REVENUE_TREND_DATA = [
  {time: '08:00', Revenue: 18000, Target: 15000},
  {time: '10:00', Revenue: 35000, Target: 30000},
  {time: '12:00', Revenue: 72000, Target: 60000},
  {time: '14:00', Revenue: 95000, Target: 80000},
  {time: '16:00', Revenue: 82000, Target: 75000},
  {time: '18:00', Revenue: 110000, Target: 90000},
  {time: '20:00', Revenue: 68000, Target: 60000},
];

export const ORDERS_TREND_DATA = [
  {time: '08:00', Orders: 42},
  {time: '10:00', Orders: 88},
  {time: '12:00', Orders: 165},
  {time: '14:00', Orders: 210},
  {time: '16:00', Orders: 184},
  {time: '18:00', Orders: 245},
  {time: '20:00', Orders: 135},
];

export const SALES_FUNNEL_STAGES: FunnelStage[] = [
  {stage: 'Visitors', count: 12400, label: 'Store & Web Visitors', conversionRate: '100%', color: '#3b82f6'},
  {stage: 'Product Views', count: 8680, label: 'Browsed Items', conversionRate: '70%', color: '#6366f1'},
  {stage: 'Add to Cart', count: 4340, label: 'Cart Created', conversionRate: '50%', color: '#8b5cf6'},
  {stage: 'Checkout Initiated', count: 3100, label: 'Entered Checkout', conversionRate: '71.4%', color: '#ec4899'},
  {stage: 'Purchased', count: 2951, label: 'Order Completed', conversionRate: '95.2%', color: '#10b981'},
];

export const PAYMENT_BREAKDOWN_DATA: PaymentBreakdownItem[] = [
  {method: 'UPI', amount: '₹1,97,200', percentage: 58, color: '#10b981'},
  {method: 'Credit & Debit Cards', amount: '₹95,200', percentage: 28, color: '#3b82f6'},
  {method: 'Store Credit / LYT', amount: '₹34,000', percentage: 10, color: '#f59e0b'},
  {method: 'Cash & POS', amount: '₹13,600', percentage: 4, color: '#8b5cf6'},
];

export const STORE_PERFORMANCE_DATA = [
  {store: 'Indiranagar Flagship', Revenue: 910000},
  {store: 'Koramangala 80ft', Revenue: 520000},
  {store: 'Jayanagar 4th Block', Revenue: 400000},
  {store: 'Whitefield Main', Revenue: 330000},
];

export const TOP_PRODUCTS_DATA: TopProductRow[] = [
  {id: 'tp1', name: 'Signature Espresso Blend (1kg)', category: 'Beverage & Beans', unitsSold: 482, revenue: '₹1,44,600', growth: '+18.4%', growthDirection: 'up', stockCount: 142, stockStatus: 'in_stock'},
  {id: 'tp2', name: 'Artisanal Cold Brew Pack (6x)', category: 'Ready to Drink', unitsSold: 310, revenue: '₹93,000', growth: '+12.1%', growthDirection: 'up', stockCount: 18, stockStatus: 'low_stock'},
  {id: 'tp3', name: 'Ceramic Barista Mug (Matte Black)', category: 'Merchandise', unitsSold: 215, revenue: '₹75,250', growth: '+8.9%', growthDirection: 'up', stockCount: 8, stockStatus: 'low_stock'},
  {id: 'tp4', name: 'Vanilla Bean Syrup (750ml)', category: 'Syrups', unitsSold: 184, revenue: '₹46,000', growth: '+5.4%', growthDirection: 'up', stockCount: 85, stockStatus: 'in_stock'},
  {id: 'tp5', name: 'French Press Brewer (8-Cup)', category: 'Equipment', unitsSold: 94, revenue: '₹37,600', growth: '-2.1%', growthDirection: 'down', stockCount: 0, stockStatus: 'out_of_stock'},
];

export const HEATMAP_HOURS = ['08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00'];
export const HEATMAP_DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];

export const HEATMAP_DATA: HeatmapCell[] = [
  {day: 'Mon', hour: '12:00', value: 65},
  {day: 'Mon', hour: '18:00', value: 85},
  {day: 'Fri', hour: '18:00', value: 98},
  {day: 'Sat', hour: '14:00', value: 92},
  {day: 'Sat', hour: '18:00', value: 100},
  {day: 'Sun', hour: '12:00', value: 78},
  {day: 'Sun', hour: '18:00', value: 95},
];

export const FORECAST_TREND_DATA: ForecastDataPoint[] = [
  {date: 'Mon', actual: 280000, forecast: 275000, lowerBound: 260000, upperBound: 290000},
  {date: 'Tue', actual: 310000, forecast: 300000, lowerBound: 285000, upperBound: 315000},
  {date: 'Wed', actual: 295000, forecast: 290000, lowerBound: 275000, upperBound: 305000},
  {date: 'Thu', actual: 340000, forecast: 330000, lowerBound: 310000, upperBound: 350000},
  {date: 'Fri (Est)', forecast: 380000, lowerBound: 355000, upperBound: 405000},
  {date: 'Sat (Est)', forecast: 420000, lowerBound: 390000, upperBound: 450000},
  {date: 'Sun (Est)', forecast: 390000, lowerBound: 360000, upperBound: 420000},
];

export const BUSINESS_ALERTS: BusinessAlert[] = [
  {
    id: 'ba1',
    type: 'low_stock',
    title: 'Low Stock Reorder Alert',
    description: 'Ceramic Barista Mug has only 8 units left at Koramangala 80ft.',
    actionText: 'Reorder Stock',
    severity: 'critical',
  },
  {
    id: 'ba2',
    type: 'refund_spike',
    title: 'Refund Spike Detected',
    description: 'Whitefield store processed 4 return requests in the last 2 hours.',
    actionText: 'Review Return Audit',
    severity: 'warning',
  },
  {
    id: 'ba3',
    type: 'best_seller',
    title: 'Best Seller Momentum',
    description: 'Signature Espresso Blend sales spiked +18.4% above weekly baseline.',
    actionText: 'Promote Banner',
    severity: 'success',
  },
  {
    id: 'ba4',
    type: 'promotion_opportunity',
    title: 'Weekend Upsell Opportunity',
    description: 'Combine Cold Brew Pack with Syrups for a +₹250 AOV expansion.',
    actionText: 'Launch Campaign',
    severity: 'info',
  },
];
