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

enum Api {
  getProvinceAlarm = '/province/alarm/getProvinceAlarm',
  getMineData = '/province/mineData/getMineData',
  getGoafData = '/province/device/getGoafList',
  getProvinceAlarmHistory = '/province/alarm/getProvinceAlarmHistory',
  getEnfMineTreeData = '/jeecg-system/sys/user/getEnfMineTreeData',
  getProvinceAlarmNum = '/province/alarm/getProvinceAlarmNum',
  resolveAlarm = '/province/alarm/solveProvinceAlarm',
}
//根据预警类型查询不同等级数量
export const getProvinceAlarmNum = (params) =>
  defHttp.post(
    {
      url: Api.getProvinceAlarmNum,
      params,
    },
    { joinParamsToUrl: true }
  );
//查询煤矿列表
export const getMineData = (params) =>
  defHttp.post({
    url: Api.getMineData,
    params,
  });
//查询密闭列表
export const getGoafData = (params) =>
  defHttp.post(
    {
      url: Api.getGoafData,
      params,
    },
    {
      joinParamsToUrl: true,
    }
  );
//查询预警历史数据
export const getProvinceAlarmHistory = (params) =>
  defHttp.post(
    {
      url: Api.getProvinceAlarmHistory,
      params: {
        alarmType: 'leakageAlarm',
        ...params,
      },
    },
    {
      joinParamsToUrl: true,
    }
  );
//查询预警数据
export const getProvinceAlarm = (params) =>
  defHttp.post(
    {
      url: Api.getProvinceAlarm,
      params,
    },
    {
      joinParamsToUrl: true,
    }
  );
//获取执法处以及区域数据
export const getEnfMineTreeData = () =>
  defHttp.get({
    url: Api.getEnfMineTreeData,
  });
// 解决预警
export const resolveAlarm = (params) =>
  defHttp.post({
    url: Api.resolveAlarm,
    params,
  });
