import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AlarmLevelVO, AlarmLevelForm, AlarmLevelQuery } from '@/api/dms/alarmLevel/types';

/**
 * 查询报警级别列表
 * @param query
 * @returns {*}
 */

export const listAlarmLevel = (query?: AlarmLevelQuery): AxiosPromise<AlarmLevelVO[]> => {
  return request({
    url: '/dms/alarmLevel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询报警级别详细
 * @param alarmLevelId
 */
export const getAlarmLevel = (alarmLevelId: string | number): AxiosPromise<AlarmLevelVO> => {
  return request({
    url: '/dms/alarmLevel/' + alarmLevelId,
    method: 'get'
  });
};

/**
 * 新增报警级别
 * @param data
 */
export const addAlarmLevel = (data: AlarmLevelForm) => {
  return request({
    url: '/dms/alarmLevel',
    method: 'post',
    data: data
  });
};

/**
 * 修改报警级别
 * @param data
 */
export const updateAlarmLevel = (data: AlarmLevelForm) => {
  return request({
    url: '/dms/alarmLevel',
    method: 'put',
    data: data
  });
};

/**
 * 删除报警级别
 * @param alarmLevelId
 */
export const delAlarmLevel = (alarmLevelId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/alarmLevel/' + alarmLevelId,
    method: 'delete'
  });
};


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