import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProductExquisiteVO, ProductExquisiteForm, ProductExquisiteQuery } from '@/api/product/productExquisite/types';

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

export const listProductExquisite = (query?: ProductExquisiteQuery): AxiosPromise<ProductExquisiteVO[]> => {
  return request({
    url: '/product/productExquisite/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询精品商品池详细
 * @param productId
 */
export const getProductExquisite = (productId: string | number): AxiosPromise<ProductExquisiteVO> => {
  return request({
    url: '/product/productExquisite/' + productId,
    method: 'get'
  });
};

/**
 * 新增精品商品池
 * @param data
 */
export const addProductExquisite = (data: ProductExquisiteForm) => {
  return request({
    url: '/product/productExquisite',
    method: 'post',
    data: data
  });
};

/**
 * 修改精品商品池
 * @param data
 */
export const updateProductExquisite = (data: ProductExquisiteForm) => {
  return request({
    url: '/product/productExquisite',
    method: 'put',
    data: data
  });
};

/**
 * 删除精品商品池
 * @param productId
 */
export const delProductExquisite = (productId: string | number | Array<string | number>) => {
  return request({
    url: '/product/productExquisite/' + productId,
    method: 'delete'
  });
};
