import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseDeviceSuppliesVO, DmsBaseDeviceSuppliesForm, DmsBaseDeviceSuppliesQuery } from '@/api/dms/dmsBaseDeviceSupplies/types';

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

export const listDmsBaseDeviceSupplies = (query?: DmsBaseDeviceSuppliesQuery): AxiosPromise<DmsBaseDeviceSuppliesVO[]> => {
  return request({
    url: '/dms/dmsBaseDeviceSupplies/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备配套信息详细
 * @param deviceSuppliesId
 */
export const getDmsBaseDeviceSupplies = (deviceSuppliesId: string | number): AxiosPromise<DmsBaseDeviceSuppliesVO> => {
  return request({
    url: '/dms/dmsBaseDeviceSupplies/' + deviceSuppliesId,
    method: 'get'
  });
};

/**
 * 新增设备配套信息
 * @param data
 */
export const addDmsBaseDeviceSupplies = (data: DmsBaseDeviceSuppliesForm) => {
  return request({
    url: '/dms/dmsBaseDeviceSupplies',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备配套信息
 * @param data
 */
export const updateDmsBaseDeviceSupplies = (data: DmsBaseDeviceSuppliesForm) => {
  return request({
    url: '/dms/dmsBaseDeviceSupplies',
    method: 'put',
    data: data
  });
};

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


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