import request from '@/utils/request';
import type { EmsActionResponse, EmsDetailResponse, EmsRecordAlarmRuleVO, EmsId, EmsIdParam, EmsListResponse, EmsQuery } from '../types';

// 查询异常告警规则列表
export function listRecordAlarmRule(query?: EmsQuery): Promise<EmsListResponse<EmsRecordAlarmRuleVO>> {
  return request({
    url: '/ems/record/recordAlarmRule/list',
    method: 'get',
    params: query
  });
}

// 查询异常告警规则详细
export function getRecordAlarmRule(objId: EmsId): Promise<EmsDetailResponse<EmsRecordAlarmRuleVO>> {
  return request({
    url: '/ems/record/recordAlarmRule/' + objId,
    method: 'get'
  });
}

// 新增异常告警规则
export function addRecordAlarmRule(data: EmsRecordAlarmRuleVO): Promise<EmsActionResponse<EmsRecordAlarmRuleVO>> {
  return request({
    url: '/ems/record/recordAlarmRule',
    method: 'post',
    data: data
  });
}

// 修改异常告警规则
export function updateRecordAlarmRule(data: EmsRecordAlarmRuleVO): Promise<EmsActionResponse<EmsRecordAlarmRuleVO>> {
  return request({
    url: '/ems/record/recordAlarmRule',
    method: 'put',
    data: data
  });
}

// 删除异常告警规则
export function delRecordAlarmRule(objId: EmsIdParam): Promise<EmsActionResponse> {
  return request({
    url: '/ems/record/recordAlarmRule/' + objId,
    method: 'delete'
  });
}

// 查询异常告警规则详细
export function getEmsRecordAlarmRuleTotalCount(): Promise<EmsDetailResponse<number>> {
  return request({
    url: '/ems/record/recordAlarmRule/getEmsRecordAlarmRuleTotalCount',
    method: 'get'
  });
}

// 查询异常告警规则
export function getEmsRecordAlarmRuleList(query?: EmsQuery): Promise<EmsListResponse<EmsRecordAlarmRuleVO>> {
  return request({
    url: '/ems/record/recordAlarmRule/getEmsRecordAlarmRuleList',
    method: 'get',
    params: query
  });
}
