import { api } from './api';

/**
 * Analytics API
 * Endpoints for dashboard analytics data
 */

export interface AnalyticsParams {
  period?: string; // '7', '14', '30', 'all'
  start_date?: string; // ISO date for custom range
  end_date?: string; // ISO date for custom range
  granularity?: 'day' | 'week' | 'month';
}

export const AnalyticsApi = {
  /**
   * Dashboard Overview
   * GET /analytics/overview
   */
  overview: (params?: AnalyticsParams) => 
    api.get('/analytics/overview', params),

  /**
   * Revenue Analytics
   * GET /analytics/revenue
   */
  revenue: (params?: AnalyticsParams) => 
    api.get('/analytics/revenue', params),

  /**
   * Orders Analytics
   * GET /analytics/orders
   */
  orders: (params?: AnalyticsParams) => 
    api.get('/analytics/orders', params),

  /**
   * Products Analytics
   * GET /analytics/products
   */
  products: (params?: AnalyticsParams) => 
    api.get('/analytics/products', params),

  /**
   * Customers Analytics
   * GET /analytics/customers
   */
  customers: (params?: AnalyticsParams) => 
    api.get('/analytics/customers', params),

  /**
   * Coupons Analytics
   * GET /analytics/coupons
   */
  coupons: (params?: AnalyticsParams) => 
    api.get('/analytics/coupons', params),

  /**
   * Taxes Analytics
   * GET /analytics/taxes
   */
  taxes: (params?: AnalyticsParams) => 
    api.get('/analytics/taxes', params),
};
