import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceModeParameterVO, DeviceModeParameterForm, DeviceModeParameterQuery } from '@/api/dms/deviceModeParameter/types';

/**
 * 查询设备参数列表
 * @param query
 * @returns {*}
 */

export const listDeviceModeParameter = (query?: DeviceModeParameterQuery): AxiosPromise<DeviceModeParameterVO[]> => {
  return request({
    url: '/dms/deviceModeParameter/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备参数详细
 * @param modeParameterId
 */
export const getDeviceModeParameter = (modeParameterId: string | number): AxiosPromise<DeviceModeParameterVO> => {
  return request({
    url: '/dms/deviceModeParameter/' + modeParameterId,
    method: 'get'
  });
};

/**
 * 新增设备参数
 * @param data
 */
export const addDeviceModeParameter = (data: DeviceModeParameterForm) => {
  return request({
    url: '/dms/deviceModeParameter',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备参数
 * @param data
 */
export const updateDeviceModeParameter = (data: DeviceModeParameterForm) => {
  return request({
    url: '/dms/deviceModeParameter',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备参数
 * @param modeParameterId
 */
export const delDeviceModeParameter = (modeParameterId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/deviceModeParameter/' + modeParameterId,
    method: 'delete'
  });
};


/**
 * 下拉框查询设备参数列表
 * @param query
 * @returns {*}
 */
export function getDmsDeviceModeParameterList (query) {
    return request({
        url: '/dms/deviceModeParameter/getDmsDeviceModeParameterList',
        method: 'get',
        params: query
    });
};
