/**
 * 数据统计相关API
 * 复用后端 StatisticsController 接口
 */

import { get } from '@/utils/request';

export interface StatisticsQueryParams {
  startDate: string;
  endDate: string;
  shopId?: number;
}

/**
 * 获取经营概览统计
 */
export async function getStatisticsOverview(params: { startDate: string; endDate: string; shopId?: number }): Promise<any> {
  return get('/statistics/overview', params);
}

/**
 * 获取品类销售概览
 */
export async function getCategoryOverview(params: { startDate: string; endDate: string; shopId?: number }): Promise<any> {
  return get('/statistics/category/overview', params);
}

/**
 * 获取商品销售排行
 */
export async function getProductTop(params: { startDate: string; endDate: string; type: string; limit?: number }): Promise<any> {
  return get('/statistics/product/top', params);
}

/**
 * 获取门店业绩排行
 */
export async function getShopRanking(params: { startDate: string; endDate: string; type: string; limit?: number }): Promise<any> {
  return get('/statistics/shop/ranking', params);
}

/**
 * 获取设备销售概览
 */
export async function getDeviceOverview(params: { startDate: string; endDate: string; shopId?: number }): Promise<any> {
  return get('/statistics/device/overview', params);
}

/**
 * 获取利润概览
 */
export async function getProfitOverview(params: { startDate: string; endDate: string }): Promise<any> {
  return get('/statistics/profit/overview', params);
}
