import request from '@/utils/request'

/**
 * 上传通话录音文件
 * @param {FormData} formData - 包含 file, externalContactId, userId
 */
export function uploadFollowUpFile(formData) {
  return request({
    url: '/scrm/customer/followUp/upload',
    method: 'post',
    data: formData,
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}

/**
 * 保存跟进记录和录音（JSON方式）
 * @param {Object} data
 * @param {string} data.externalContactId - 企微客户ID
 * @param {string} data.visitRecords - 跟进记录JSON字符串
 * @param {string} data.recordings - 录音记录JSON字符串
 */
export function saveFollowUpRecord(data) {
  return request({
    url: '/scrm/customer/followUp/save',
    method: 'post',
    data: data
  })
}

/**
 * 获取跟进统计（未跟进天数、跟进次数）
 * @param {Object} query
 * @param {string} query.externalContactId
 */
export function getFollowUpStatistics(query) {
  return request({
    url: '/scrm/customer/followUp/statistics',
    method: 'get',
    params: query
  })
}
