import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RecordAlarmDataVO, RecordAlarmDataForm, RecordAlarmDataQuery } from '@/api/ems/record/types';

/**
 * 查询告警数据列表
 */
export function listRecordAlarmData(query: RecordAlarmDataQuery): AxiosPromise<RecordAlarmDataVO[]> {
  return request({
    url: '/ems/record/recordAlarmData/list',
    method: 'get',
    params: query
  });
}

/**
 * 查询告警数据详细
 */
export function getRecordAlarmData(objId: string | number): AxiosPromise<RecordAlarmDataVO> {
  return request({
    url: '/ems/record/recordAlarmData/' + objId,
    method: 'get'
  });
}

/**
 * 新增告警数据
 */
export function addRecordAlarmData(data: RecordAlarmDataForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordAlarmData',
    method: 'post',
    data: data
  });
}

/**
 * 修改告警数据
 */
export function updateRecordAlarmData(data: RecordAlarmDataForm): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordAlarmData',
    method: 'put',
    data: data
  });
}

/**
 * 删除告警数据
 */
export function delRecordAlarmData(objId: string | number | Array<string | number>): AxiosPromise<any> {
  return request({
    url: '/ems/record/recordAlarmData/' + objId,
    method: 'delete'
  });
}

/**
 * 处理告警
 */
export function handleAlarm(data: RecordAlarmDataForm) {
  return request({
    url: '/ems/record/recordAlarmData/handle',
    method: 'post',
    data: data
  });
}
