import { http } from "@/utils/http";

/** 获取仪表盘数据 */
export const getDashboard = (stationId?: string) => {
  return http.request<any>("get", "/stat/dashboard", {
    params: stationId ? { stationId } : {}
  });
};

/** 获取趋势数据 */
export const getTrend = (data: {
  startTime: string;
  endTime: string;
  type: string;
  pageSize: number;
  stationId?: string;
}) => {
  return http.request<any>("post", "/stat/trend", { data });
};

/** 获取洗车设备状态 */
export const getWashDeviceStatus = (stationId?: string) => {
  return http.request<any>("get", "/stat/washDeviceStatus", {
    params: stationId ? { stationId } : {}
  });
};

/** 日统计列表 */
export const getDailyStatList = (data?: object) => {
  return http.request<any>("post", "/daily-stat/list", { data });
};

/** 重新同步日统计 */
export const syncDailyStat = (data: { statDate: string }) => {
  return http.request<any>("post", "/daily-stat/sync", { data });
};

/** 批量同步日统计 */
export const syncDailyStatBatch = (data: { startDate: string; endDate: string }) => {
  return http.request<any>("post", "/daily-stat/batch-sync", { data });
};

/** 月统计列表 */
export const getMonthStatList = (data?: object) => {
  return http.request<any>("post", "/month-stat/list", { data });
};

/** 重新同步月统计 */
export const syncMonthStat = (data: { statMonth: string }) => {
  return http.request<any>("post", "/month-stat/sync", { data });
};
