import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  DeviceModeFunctionVO,
  DeviceModeFunctionForm,
  DeviceModeFunctionQuery
} from '@/api/dms/deviceModeFunction/types';

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

export const listDeviceModeFunction = (query?: DeviceModeFunctionQuery): AxiosPromise<DeviceModeFunctionVO[]> => {
  return request({
    url: '/dms/deviceModeFunction/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备模型功能详细
 * @param modeFunctionId
 */
export const getDeviceModeFunction = (modeFunctionId: string | number): AxiosPromise<DeviceModeFunctionVO> => {
  return request({
    url: '/dms/deviceModeFunction/' + modeFunctionId,
    method: 'get'
  });
};

/**
 * 新增设备模型功能
 * @param data
 */
export const addDeviceModeFunction = (data: DeviceModeFunctionForm) => {
  return request({
    url: '/dms/deviceModeFunction',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备模型功能
 * @param data
 */
export const updateDeviceModeFunction = (data: DeviceModeFunctionForm) => {
  return request({
    url: '/dms/deviceModeFunction',
    method: 'put',
    data: data
  });
};

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


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