import { defHttp } from '/@/utils/http/axios';
import { ExportQueryParam } from './model/exportModel';

enum ReportManagerApi {
  GET_EXPORT_API = '/report/generate/record',
  DELETE_EXPORT_API = '/report/generate/record',
  GET_TELEMETRY_API = '/plugins/telemetry/',
}

//报表导出分页
export const exportPage = (params: ExportQueryParam) => {
  return defHttp.get<ExportQueryParam>({
    url: ReportManagerApi.GET_EXPORT_API,
    params,
  });
};

//报表导出删除
export const deleteExportManage = (ids: string[]) => {
  return defHttp.delete({
    url: ReportManagerApi.DELETE_EXPORT_API,
    data: {
      ids: ids,
    },
  });
};

//报表查看趋势图
export const exportViewChartApi = (entityId, params) => {
  return defHttp.get<ExportQueryParam>(
    {
      url:
        ReportManagerApi.GET_TELEMETRY_API + 'DEVICE' + '/' + entityId + '/values' + '/timeseries',
      params,
    },
    {
      joinPrefix: false,
    }
  );
};
