import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BlacklistVO, BlacklistForm, BlacklistQuery } from '@/api/product/blacklist/types';

/**
 * 查询产品黑名单列表
 * @param query
 * @returns {*}
 */

export const listBlacklist = (query?: BlacklistQuery): AxiosPromise<BlacklistVO[]> => {
  return request({
    url: '/product/blacklist/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品黑名单详细
 * @param id
 */
export const getBlacklist = (id: string | number): AxiosPromise<BlacklistVO> => {
  return request({
    url: '/product/blacklist/' + id,
    method: 'get'
  });
};

/**
 * 新增产品黑名单
 * @param data
 */
export const addBlacklist = (data: BlacklistForm) => {
  return request({
    url: '/product/blacklist',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品黑名单
 * @param data
 */
export const updateBlacklist = (data: BlacklistForm) => {
  return request({
    url: '/product/blacklist',
    method: 'put',
    data: data
  });
};

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