import { ResPage, User } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 数据管理模块
 */
// 数据管理搜索参数类型
export interface ReqDataManageParams {
  dtStart: string;
  dtEnd: string;
  advertiserId: number;
  materialId: string;
  page: number;
  size: number;
}

// 广告主信息
export interface AdvertiserInfo {
  advertiserId: number;
  advertiserName: string;
}

// 素材消耗列表返回类型
export interface ResMaterialCostList {
  dt: string;
  advertiserInfo: AdvertiserInfo;
  materialId: number;
  materialName: string;
  materialMode: string;
  materialType: string;
  createTime: string;
  duration: number;
  relatedAdCnt: number;
  relatedCreativeCnt: number;
  videoSource: string;
  statCost: number;
  showCnt: number;
  ctr: number;
  clickCnt: number;
  ecpConvertRate: number;
  ecpConvertCnt: number;
  ecpCpaPlatform: number;
}

// 广告主账户列表请求参数
export interface ReqAdvertiserAccountParams {
  advertiserId: string;
}

// 广告主账户列表返回类型
export interface AdvertiserAccountList {
  advertiserId: number;
  advertiserName: string;
  advertiserStatus: string;
  advCompanyId: number;
  advCompanyName: string;
  firstAgentId: number;
  firstAgentName: string;
  firstAgentCompanyId: number;
  firstAgentCompanyName: string;
  firstIndustryName: string;
  secondIndustryName: string;
  selfOperationTag: string;
}
// 获取素材消耗列表
export const getMaterialCostList = (params: ReqDataManageParams) => {
  return http.get<ResPage<ResMaterialCostList>>(PORT1 + `/ocean/engine/data/material/cost/page`, params);
};

// 同步素材消耗
export const syncMaterialCost = (params: any) => {
  return http.post<any>(PORT1 + `/ocean/engine/data/material/cost`, params);
};

// 获取广告主账户列表
export const getAdvertiserAccountList = (params: ReqAdvertiserAccountParams) => {
  return http.get<ResPage<AdvertiserAccountList>>(PORT1 + `/ocean/engine/data/advertiser/account/page`, params);
};

// 批量更新广告主账户
export const updateAdvertiserAccountBatch = (params: any) => {
  return http.post<any>(PORT1 + `/ocean/engine/data/advertiser/account/update/batch`, params);
};

// 获取广告主账户消耗日期列表
export const getAdvertiserAccountCostDtList = (params: any) => {
  return http.get<ResPage<any>>(PORT1 + `/ocean/engine/data/advertiser/account/cost/dt/page`, params);
};
// 同步广告主消耗数据
export const syncAdvertiserAccountCostDt = (params: any) => {
  return http.post<any>(PORT1 + `/ocean/engine/data/advertiser/account/cost/dt`, params);
};

// 广告主消耗统计-总计
export const getAdvertiserAccountCostDtRangeStaticsTotal = (params: any) => {
  return http.get<any>(PORT1 + `/ocean/engine/data/advertiser/account/cost/dt/range/statics/total`, params);
};
// 广告主消耗统计-分页
export const getAdvertiserAccountCostDtRangeStaticsPage = (params: any) => {
  return http.get<any>(PORT1 + `/ocean/engine/data/advertiser/account/cost/dt/range/statics/page`, params);
};