import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BaseDeviceTypeVO, BaseDeviceTypeForm, BaseDeviceTypeQuery } from '@/api/mes/baseDeviceType/types';

/**
 * 查询设备类型信息列表
 * @param query
 * @returns {*}
 */

export const listBaseDeviceType = (query?: BaseDeviceTypeQuery): AxiosPromise<BaseDeviceTypeVO[]> => {
  return request({
    url: '/mes/baseDeviceType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备类型信息详细
 * @param deviceTypeId
 */
export const getBaseDeviceType = (deviceTypeId: string | number): AxiosPromise<BaseDeviceTypeVO> => {
  return request({
    url: '/mes/baseDeviceType/' + deviceTypeId,
    method: 'get'
  });
};

/**
 * 新增设备类型信息
 * @param data
 */
export const addBaseDeviceType = (data: BaseDeviceTypeForm) => {
  return request({
    url: '/mes/baseDeviceType',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备类型信息
 * @param data
 */
export const updateBaseDeviceType = (data: BaseDeviceTypeForm) => {
  return request({
    url: '/mes/baseDeviceType',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备类型信息
 * @param deviceTypeId
 */
export const delBaseDeviceType = (deviceTypeId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/baseDeviceType/' + deviceTypeId,
    method: 'delete'
  });
};


/**
 * 下拉框查询设备类型信息列表
 * @param query
 * @returns {*}
 */
export function getBaseDeviceTypeList (query) {
    return request({
        url: '/mes/baseDeviceType/getBaseDeviceTypeList',
        method: 'get',
        params: query
    });
};
