import { defHttp } from '/@/utils/http/axios';
import { Result, FileStream } from '/#/axios';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();

enum Api {
  logData = '/service/agent/log/logData',
  logList = '/service/agent/log/logList',
  export = '/service/agent/log/export',
  contactUsList = '/service/agent/contactUs/list',
  pointList = '/service/agent/contactUs/pointList',
  contactUsExport = '/service/agent/contactUs/export',
  exportPoint = '/service/agent/contactUs/exportPoint',
  // aa = '/service/agent/log/aa',
}

/**
 * @description: Get sample list value
 */

interface logDataResule {
  lastDownNum: number;
  lastHighNum: number;
  lastMajorNum: number;
}
export const logData = (params) =>
  defHttp.get<logDataResule>({
    url: Api.logData,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const contactUsList = (params) =>
  defHttp.post<logDataResule>({
    url: Api.contactUsList,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const pointList = (params) =>
  defHttp.post<logDataResule>({
    url: Api.pointList,
    params: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const logList = (params) =>
  defHttp.post<Result>({
    url: Api.logList,
    params: params,
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });

export const DownExport = (params) =>
  defHttp.downloadFile<FileStream>({
    url: Api.export + `?lang=${params.lang}`,
    params: params,
    fileName: t('routes.equity.listTitle') + '.xlsx',
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
    responseType: 'blob',
  });

export const DownCountExport1 = (params) =>
  defHttp.downloadFile<FileStream>({
    url: Api.contactUsExport + `?lang=${params.lang}`,
    params: params,
    fileName: t('routes.count.name1') + '.xlsx',
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
    responseType: 'blob',
  });

export const DownCountExport2 = (params) =>
  defHttp.downloadFile<FileStream>({
    url: Api.exportPoint + `?lang=${params.lang}`,
    params: params,
    fileName: t('routes.count.name2') + '.xlsx',
    // data: params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
    responseType: 'blob',
  });
