import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FollowVO, FollowForm, FollowQuery } from './types';

/**
 * 查询客户跟进记录
 * @param query
 * @returns {*}
 */

export const listFollow = (query?: FollowQuery): AxiosPromise<{records:FollowVO[],total:number}> => {
  return request({
    url: '/customer-follow-up/list',
    method: 'post',
    data: query
  });
};

/**
 * 查询客户跟进记录
 * @param id
 */
export const getFollow = (id: string | number): AxiosPromise<FollowVO> => {
  return request({
    url: '/customer-follow-up/get-by-id?id=' + id,
    method: 'get'
  });
};

/**
 * 新增/修改客户跟进记录
 * @param data
 */
export const addFollow = (data: any) => {
  return request({
    url: '/customer-follow-up/add',
    method: 'post',
    data: data
  });
};


/**
 * 删除客户跟进记录
 * @param id
 */
export const delFollow = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer-follow-up/delete',
    method: 'post',
    data: { id }
  });
};

/**
 * 查询跟进邮件
 * @param query
 * @returns {*}
 */

export const emailFollow = (query?: FollowQuery & PageQuery) => {
  return request({
    url: '/customer-follow-up-emails/list',
    method: 'post',
    data: query
  });
};
