import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SpecialVO, SpecialForm, SpecialQuery, Customer } from '@/api/customer/special/types';

/**
 * 查询特殊客户列表
 * @param query
 * @returns {*}
 */

export const listSpecial = (query?: SpecialQuery): AxiosPromise<SpecialVO[]> => {
  return request({
    url: '/customer/special/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询特殊客户详细
 * @param specialId
 */
export const getSpecial = (data: SpecialVO) => {
  return request({
    url: '/customer/special/querySimilarCustomer',
    method: 'post',
    data: data
  });
};

/**
 * 新增特殊客户
 * @param data
 */
export const addSpecial = (data: SpecialForm) => {
  return request({
    url: '/customer/special',
    method: 'post',
    data: data
  });
};

/**
 * 修改特殊客户
 * @param data
 */
export const updateSpecial = (data: SpecialForm) => {
  return request({
    url: '/customer/special',
    method: 'put',
    data: data
  });
};

/**
 * 删除特殊客户
 * @param specialId
 */
export const delSpecial = (specialId: string | number | Array<string | number>) => {
  return request({
    url: '/customer/special/' + specialId,
    method: 'delete'
  });
};

export const updateSpecialAuditPassed = (specialId: string | number) => {
  const data = {
    specialId
  };
  return request({
    url: '/customer/special/updateAuditPassed',
    method: 'post',
    data: data
  });
};

export const updateSpecialAuditFail = (specialId: string | number) => {
  const data = {
    specialId
  };
  return request({
    url: '/customer/special/updateAuditFail',
    method: 'post',
    data: data
  });
};
