import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ConstructionBlacklistVO, ConstructionBlacklistForm, ConstructionBlacklistQuery } from '@/api/project/constructionBlacklist/types';

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

export const listConstructionBlacklist = (query?: ConstructionBlacklistQuery): AxiosPromise<ConstructionBlacklistVO[]> => {
  return request({
    url: '/project/constructionBlacklist/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询黑名单详细
 * @param id
 */
export const getConstructionBlacklist = (id: string | number): AxiosPromise<ConstructionBlacklistVO> => {
  return request({
    url: '/project/constructionBlacklist/' + id,
    method: 'get'
  });
};

/**
 * 新增黑名单
 * @param data
 */
export const addConstructionBlacklist = (data: ConstructionBlacklistForm) => {
  return request({
    url: '/project/constructionBlacklist',
    method: 'post',
    data: data
  });
};

/**
 * 修改黑名单
 * @param data
 */
export const updateConstructionBlacklist = (data: ConstructionBlacklistForm) => {
  return request({
    url: '/project/constructionBlacklist',
    method: 'put',
    data: data
  });
};

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