import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProdBaseMachineInfoVO, ProdBaseMachineInfoForm, ProdBaseMachineInfoQuery } from '@/api/dms/dmsBaseMachineInfo/types';

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

export const listDmsBaseMachineInfo = (query?: ProdBaseMachineInfoQuery): AxiosPromise<ProdBaseMachineInfoVO[]> => {
  return request({
    url: '/dms/dmsBaseMachineInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备信息详细
 * @param machineId
 */
export const getDmsBaseMachineInfo  = (machineId: string | number): AxiosPromise<ProdBaseMachineInfoVO> => {
  return request({
    url: '/dms/dmsBaseMachineInfo/' + machineId,
    method: 'get'
  });
};

/**
 * 新增设备信息
 * @param data
 */
export const addProdBaseMachineInfo  = (data: ProdBaseMachineInfoForm) => {
  return request({
    url: '/dms/dmsBaseMachineInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备信息
 * @param data
 */
export const updateProdBaseMachineInfo  = (data: ProdBaseMachineInfoForm) => {
  return request({
    url: '/dms/dmsBaseMachineInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备信息
 * @param machineId
 */
export const delDmsBaseMachineInfo  = (machineId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseMachineInfo/' + machineId,
    method: 'delete'
  });
};


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