import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseDeviceSupplierVO, DmsBaseDeviceSupplierForm, DmsBaseDeviceSupplierQuery } from '@/api/dms/dmsBaseDeviceSupplier/types';

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

export const listDmsBaseDeviceSupplier = (query?: DmsBaseDeviceSupplierQuery): AxiosPromise<DmsBaseDeviceSupplierVO[]> => {
  return request({
    url: '/dms/dmsBaseDeviceSupplier/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备供应商信息详细
 * @param supplierId
 */
export const getDmsBaseDeviceSupplier = (supplierId: string | number): AxiosPromise<DmsBaseDeviceSupplierVO> => {
  return request({
    url: '/dms/dmsBaseDeviceSupplier/' + supplierId,
    method: 'get'
  });
};

/**
 * 新增设备供应商信息
 * @param data
 */
export const addDmsBaseDeviceSupplier = (data: DmsBaseDeviceSupplierForm) => {
  return request({
    url: '/dms/dmsBaseDeviceSupplier',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备供应商信息
 * @param data
 */
export const updateDmsBaseDeviceSupplier = (data: DmsBaseDeviceSupplierForm) => {
  return request({
    url: '/dms/dmsBaseDeviceSupplier',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备供应商信息
 * @param supplierId
 */
export const delDmsBaseDeviceSupplier = (supplierId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseDeviceSupplier/' + supplierId,
    method: 'delete'
  });
};


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