import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProductBannerVO, ProductBannerForm, ProductBannerQuery } from '@/api/system/physical/productBanner/types';

/**
 * 查询实物商品轮播广告图列表
 * @param query
 * @returns {*}
 */

export const listProductBanner = (query?: ProductBannerQuery): AxiosPromise<ProductBannerVO[]> => {
  return request({
    url: '/physical/productBanner/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询实物商品轮播广告图详细
 * @param id
 */
export const getProductBanner = (id: string | number): AxiosPromise<ProductBannerVO> => {
  return request({
    url: '/physical/productBanner/' + id,
    method: 'get'
  });
};

/**
 * 新增实物商品轮播广告图
 * @param data
 */
export const addProductBanner = (data: ProductBannerForm) => {
  return request({
    url: '/physical/productBanner',
    method: 'post',
    data: data
  });
};

/**
 * 修改实物商品轮播广告图
 * @param data
 */
export const updateProductBanner = (data: ProductBannerForm) => {
  return request({
    url: '/physical/productBanner',
    method: 'put',
    data: data
  });
};

/**
 * 删除实物商品轮播广告图
 * @param id
 */
export const delProductBanner = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/productBanner/' + id,
    method: 'delete'
  });
};
