import { get } from '@/api/commonApi';
import request from '@/utils/request';

// 查询能源设施告警列表
export function listAlarmInfo(query) {
  return request({
    url: '/ems/alarm-info/list',
    method: 'get',
    params: query
  })
}

// 查询能源设施告警详细
export function getAlarmInfo(id) {
  return request({
    url: '/ems/alarm-info/' + id,
    method: 'get'
  })
}

// 新增能源设施告警
export function addAlarmInfo(data) {
  return request({
    url: '/ems/alarm-info',
    method: 'post',
    data: data
  })
}

// 修改能源设施告警
export function updateAlarmInfo(data) {
  return request({
    url: '/ems/alarm-info',
    method: 'put',
    data: data
  })
}

// 删除能源设施告警
export function delAlarmInfo(id) {
  return request({
    url: '/ems/alarm-info/' + id,
    method: 'delete'
  })
}

export const fetchAlarmIndex = (params) => {
  return get('/alarm-info/alarm/type/index', params);
};

export const fetchAlarmIndexDay = (params) => {
  return get('/alarm-info/alarm/type/index/day', params);
};

export const fetchAlarmIndexMonth = (params) => {
  return get('/alarm-info/alarm/type/index/month', params);
};


export const fetchAlarmIndexYear = (params) => {
  return get('/alarm-info/alarm/type/index/year', params);
};

export const fetchSubSysIndexDay = (params) => {
  return get('/alarm-info/subsys/index/day', params);
};

export const fetchSubSysIndexMonth = (params) => {
  return get('/alarm-info/subsys/index/month', params);
};


export const fetchSubSysIndexYear = (params) => {
  return get('/alarm-info/subsys/index/year', params);
};
