import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PoolVO, PoolForm, PoolQuery } from '@/api/product/pool/types';

/**
 * 查询产品池列表
 * @param query
 * @returns {*}
 */

export const listPool = (query?: PoolQuery): AxiosPromise<PoolVO[]> => {
  return request({
    url: '/product/pool/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品池详细
 * @param id
 */
export const getPool = (id: string | number): AxiosPromise<PoolVO> => {
  return request({
    url: '/product/pool/' + id,
    method: 'get'
  });
};

/**
 * 新增产品池
 * @param data
 */
export const addPool = (data: PoolForm) => {
  return request({
    url: '/product/pool',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品池
 * @param data
 */
export const updatePool = (data: PoolForm) => {
  return request({
    url: '/product/pool',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品池
 * @param id
 */
export const delPool = (id: string | number | Array<string | number>) => {
  return request({
    url: '/product/pool/' + id,
    method: 'delete'
  });
};
