import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceModeVO, DeviceModeForm, DeviceModeQuery } from '@/api/dms/deviceMode/types';

/**
 * 查询设备模型列表
 * @param query
 * @returns {*}
 */

export const listDeviceMode = (query?: DeviceModeQuery): AxiosPromise<DeviceModeVO[]> => {
  return request({
    url: '/dms/deviceMode/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备模型详细
 * @param deviceModeId
 */
export const getDeviceMode = (deviceModeId: string | number): AxiosPromise<DeviceModeVO> => {
  return request({
    url: '/dms/deviceMode/' + deviceModeId,
    method: 'get'
  });
};

/**
 * 新增设备模型
 * @param data
 */
export const addDeviceMode = (data: DeviceModeForm) => {
  return request({
    url: '/dms/deviceMode',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备模型
 * @param data
 */
export const updateDeviceMode = (data: DeviceModeForm) => {
  return request({
    url: '/dms/deviceMode',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备模型
 * @param deviceModeId
 */
export const delDeviceMode = (deviceModeId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/deviceMode/' + deviceModeId,
    method: 'delete'
  });
};


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