import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GroupCustomerVO, GroupCustomerForm, GroupCustomerQuery } from '@/api/customer/customerFile/groupCustomer/types';

/**
 * 查询集团客户关系列表
 * @param query
 * @returns {*}
 */

export const listGroupCustomer = (query?: GroupCustomerQuery): AxiosPromise<GroupCustomerVO[]> => {
  return request({
    url: '/customer/groupCustomer/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询集团客户关系详细
 * @param id
 */
export const getGroupCustomer = (id: string | number): AxiosPromise<GroupCustomerVO> => {
  return request({
    url: '/customer/groupCustomer/' + id,
    method: 'get'
  });
};

/**
 * 新增集团客户关系
 * @param data
 */
export const addGroupCustomer = (data: GroupCustomerForm) => {
  return request({
    url: '/customer/groupCustomer',
    method: 'post',
    data: data
  });
};

/**
 * 修改集团客户关系
 * @param data
 */
export const updateGroupCustomer = (data: GroupCustomerForm) => {
  return request({
    url: '/customer/groupCustomer',
    method: 'put',
    data: data
  });
};

/**
 * 删除集团客户关系
 * @param id
 */
export const delGroupCustomer = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/groupCustomer/' + id,
    method: 'delete'
  });
};
