import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AlarmRuleLinkVO, AlarmRuleLinkForm, AlarmRuleLinkQuery } from '@/api/dms/alarmRuleLink/types';

/**
 * 查询报警规则联动信息列表
 * @param query
 * @returns {*}
 */

export const listAlarmRuleLink = (query?: AlarmRuleLinkQuery): AxiosPromise<AlarmRuleLinkVO[]> => {
  return request({
    url: '/dms/alarmRuleLink/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询报警规则联动信息详细
 * @param ruleLinkId
 */
export const getAlarmRuleLink = (ruleLinkId: string | number): AxiosPromise<AlarmRuleLinkVO> => {
  return request({
    url: '/dms/alarmRuleLink/' + ruleLinkId,
    method: 'get'
  });
};

/**
 * 新增报警规则联动信息
 * @param data
 */
export const addAlarmRuleLink = (data: AlarmRuleLinkForm) => {
  return request({
    url: '/dms/alarmRuleLink',
    method: 'post',
    data: data
  });
};

/**
 * 修改报警规则联动信息
 * @param data
 */
export const updateAlarmRuleLink = (data: AlarmRuleLinkForm) => {
  return request({
    url: '/dms/alarmRuleLink',
    method: 'put',
    data: data
  });
};

/**
 * 删除报警规则联动信息
 * @param ruleLinkId
 */
export const delAlarmRuleLink = (ruleLinkId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/alarmRuleLink/' + ruleLinkId,
    method: 'delete'
  });
};


/**
 * 下拉框查询报警规则联动信息列表
 * @param query
 * @returns {*}
 */
export function getBaseAlarmRuleLinkList(query) {
  return request({
    url: '/dms/alarmRuleLink/getBaseAlarmRuleLinkList',
    method: 'get',
    params: query
  });
};
