import { defHttp } from '/@/utils/http/axios';

enum Api {
  getGoafAlarmNum = '/province/homeData/getGoafAlarmNum',
  getGoafData = '/province/device/getGoafData',
  getProvinceAlarm = '/province/alarm/getProvinceAlarm',
  getMineData = '/province/mineData/getMineData',
  // 接入统计
  getGoafAccessCount = '/ventanaly-province/province/mineData/getGoafAccessCount',
  getRealAlarmNum = '/ventanaly-province/province/mineData/getRealAlarmNum',
  getHistoryAlarmNum = '/ventanaly-province/province/mineData/getHistoryAlarmNum',
  getAlarmType = '/ventanaly-province/province/mineData/getAlarmType',
}

// 执法处风险统计
export const getGoafAlarmNum = (params) =>
  defHttp.post(
    {
      url: Api.getGoafAlarmNum,
      params,
    },
    {
      joinParamsToUrl: true,
    }
  );

// 查询密闭监测数据
export function getGoafData(params: any) {
  return defHttp.post({ url: Api.getGoafData, params }, { joinParamsToUrl: true });
}

// 获取煤矿数据
export const getMineData = (params) =>
  defHttp.post({
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    url: Api.getMineData,
    params,
  });

//查询预警数据
export const getProvinceAlarm = (params) =>
  defHttp.post(
    {
      url: Api.getProvinceAlarm,
      params: {
        alarmType: 'overLimitAlarm',
        ...params,
      },
    },
    { joinParamsToUrl: true }
  );

// 实时预警统计
export const getRealAlarmNum = (params) =>
  defHttp.post(
    {
      url: Api.getRealAlarmNum,
      params,
    },
    {
      joinParamsToUrl: true,
    }
  );

// 接入统计
export const getGoafAccessCount = (params) =>
  defHttp.get({
    url: Api.getGoafAccessCount,
    params,
  });

// 重点矿井报警次数统计
export const getHistoryAlarmNum = (params) =>
  defHttp.post(
    {
      url: Api.getHistoryAlarmNum,
      params,
    },
    {
      joinParamsToUrl: true,
    }
  );

// 报警种类统计
export const getAlarmType = (params) =>
  defHttp.post(
    {
      url: Api.getAlarmType,
      params,
    },
    {
      joinParamsToUrl: true,
    }
  );
