import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CustomerContactVO, CustomerContactForm, CustomerContactQuery } from '@/api/customer/customerFile/customerContact/types';

/**
 * 查询客户联系人信息列表
 * @param query
 * @returns {*}
 */

export const listCustomerContact = (query?: CustomerContactQuery): AxiosPromise<CustomerContactVO[]> => {
  return request({
    url: '/customer/customerContact/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询客户联系人信息详细
 * @param id
 */
export const getCustomerContact = (id: string | number): AxiosPromise<CustomerContactVO> => {
  return request({
    url: '/customer/customerContact/' + id,
    method: 'get'
  });
};

/**
 * 新增客户联系人信息
 * @param data
 */
export const addCustomerContact = (data: CustomerContactForm) => {
  return request({
    url: '/customer/customerContact',
    method: 'post',
    data: data
  });
};

/**
 * 修改客户联系人信息
 * @param data
 */
export const updateCustomerContact = (data: CustomerContactForm) => {
  return request({
    url: '/customer/customerContact',
    method: 'put',
    data: data
  });
};

/**
 * 删除客户联系人信息
 * @param id
 */
export const delCustomerContact = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/customerContact/' + id,
    method: 'delete'
  });
};
