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',
}

/**
 * @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 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'
  });