import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AlarmTypeVO, AlarmTypeForm, AlarmTypeQuery } from '@/api/dms/alarmType/types';

/**
 * 查询报警类型列表
 * @param query
 * @returns {*}
 */

export const listAlarmType = (query?: AlarmTypeQuery): AxiosPromise<AlarmTypeVO[]> => {
  return request({
    url: '/dms/alarmType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询报警类型详细
 * @param alarmTypeId
 */
export const getAlarmType = (alarmTypeId: string | number): AxiosPromise<AlarmTypeVO> => {
  return request({
    url: '/dms/alarmType/' + alarmTypeId,
    method: 'get'
  });
};

/**
 * 新增报警类型
 * @param data
 */
export const addAlarmType = (data: AlarmTypeForm) => {
  return request({
    url: '/dms/alarmType',
    method: 'post',
    data: data
  });
};

/**
 * 修改报警类型
 * @param data
 */
export const updateAlarmType = (data: AlarmTypeForm) => {
  return request({
    url: '/dms/alarmType',
    method: 'put',
    data: data
  });
};

/**
 * 删除报警类型
 * @param alarmTypeId
 */
export const delAlarmType = (alarmTypeId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/alarmType/' + alarmTypeId,
    method: 'delete'
  });
};


/**
 * 下拉框查询报警类型列表
 * @param query
 * @returns {*}
 */
export function getBaseAlarmTypeList(query) {
  return request({
    url: '/dms/alarmType/getBaseAlarmTypeList',
    method: 'get',
    params: query
  });
};
