import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 首页模块
 */

// 首页统计数据请求参数
export interface ReqHomeStaticsParams {
  currentStart: string;
  currentEnd: string;
  dateRange: string;
}

// 首页统计数据项
export interface HomeStaticsItem {
  advertiserAccountCount: number;
  cost: number;
  noGrantCost: number;
  materialCost: number;
  firstPublishMaterialCost: number;
  highQualityMaterialCost: number;
  poorQualityMaterialCost: number;
  lowEfficiencyMaterialCost: number;
  improvableMaterialCost: number;
}

// 首页统计数据返回类型
export interface ResHomeStatics {
  current: HomeStaticsItem;
  last: HomeStaticsItem;
}

// 首页统计数据
export const getHomeStaticsAll = (params: ReqHomeStaticsParams) => {
  return http.get<ResHomeStatics>(PORT1 + `/home/statics/all`, params);
};
