import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  CustomerMergeRecordVO,
  CustomerMergeRecordForm,
  CustomerMergeRecordQuery,
  CustomerMergeSplitInfoBo
} from '@/api/customer/customerMergeSplit/types';

/**
 * 相似客户合并拆分详情页面
 * @param customerMergeSplitInfoBo
 * @returns {*}
 */

export const queryCustomerMergeSplitDetailsInfo = (customerMergeSplitInfoBo?: CustomerMergeSplitInfoBo) => {
  return request({
    url: '/customer/customerMergeSplit/queryCustomerMergeSplitDetailsInfo',
    method: 'post',
    data: customerMergeSplitInfoBo
  });
};
/**
 * 相似客户合并拆分轨迹查询
 * @param customerMergeSplitInfoBo
 * @returns {*}
 */

export const queryCustomerMergeSplitInfo = (customerMergeSplitInfoBo?: CustomerMergeSplitInfoBo) => {
  return request({
    url: '/customer/customerMergeSplit/queryCustomerMergeSplitInfo',
    method: 'get',
    params: customerMergeSplitInfoBo
  });
};
/**
 * 查询客户合并记录列表
 * @param query
 * @returns {*}
 */

export const listCustomerMergeRecord = (query?: CustomerMergeRecordQuery): AxiosPromise<CustomerMergeRecordVO[]> => {
  return request({
    url: '/customer/customerMergeRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户合并记录详细
 * @param mergeId
 */
export const getCustomerMergeRecord = (mergeId: string | number): AxiosPromise<CustomerMergeRecordVO> => {
  return request({
    url: '/customer/customerMergeRecord/' + mergeId,
    method: 'get'
  });
};

/**
 * 新增客户合并记录
 * @param data
 */
export const addCustomerMergeRecord = (data: CustomerMergeRecordForm) => {
  return request({
    url: '/customer/customerMergeRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户合并记录
 * @param data
 */
export const updateCustomerMergeRecord = (data: CustomerMergeRecordForm) => {
  return request({
    url: '/customer/customerMergeRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户合并记录
 * @param mergeId
 */
export const delCustomerMergeRecord = (mergeId: string | number | Array<string | number>) => {
  return request({
    url: '/customer/customerMergeRecord/' + mergeId,
    method: 'delete'
  });
};
