import request from '@/common/request'
const TaskApi = {
// 刷新令牌
  taskType: () => {
    return request({
      url: `/call/api/call-task-type/findListByPage?page=1&pageCount=1000`,
      method: 'POST',
	  data:{},
      custom: {
        showLoading: false, // 不用加载中
        showError: false, // 不展示错误提示
      },
    })
  },
  
  //创建任务
  addTask: (data) => {
    return request({
      url: `/call/api/task/add`,
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        loadingMsg: '新建中',
        successMsg: '新建成功',
      },
    })
  },
  
  //测试话术
  addTest: (data) => {
    return request({
      url: `/call/api/call-user-call-test-record/add`,
      method: 'POST',
      data,
      custom: {
        showSuccess: false,
        showLoading: false,
      },
    })
  },
  taskList: (data) => {
    return request({
      url: `/call/api/task/findListByPage?page=${data.page}&pageCount=${data.pageCount}`,
      method: 'POST',
  	  data,
      custom: {
        showLoading: false, // 加载中
        showError: true, // 展示错误提示
      },
    })
  },
  taskDetail: (id) => {
    return request({
      url: `/call/api/task/findById`,
      method: 'get',
  	  params: {
  	    id
  	  },
      custom: {
        showLoading: true, // 加载中
        showError: true, // 展示错误提示
      },
    })
  },
  intentionList: (id) => {
    return request({
      url: `/call/api/task/intention-options?taskId=${id}`,
      method: 'post',
      custom: {
        showLoading: false, // 加载中
        showError: true, // 展示错误提示
      },
    })
  },
  phoneList: (data) => {
    return request({
      url: `/call/api/task/phone/findListByPage`,
      method: 'post',
  	  data,
      custom: {
        showLoading: false, // 加载中
        showError: true, // 展示错误提示
      },
    })
  },
  lastTaskDetail: () => {
    return request({
      url: `/call/api/task/lastTask`,
      method: 'get',
      custom: {
        showLoading: false, // 加载中
        showError: false, // 展示错误提示
      },
    })
  },
  taskDel: (data) => {
    return request({
      url: `/call/api/task/del?id=${data.id}`,
      method: 'POST',
  	  data,
      custom: {
        showLoading: false, // 加载中
        showError: true, // 展示错误提示
      },
    })
  },
  phoneExport: (data) => {
    return request({
      url: `/call/api/task/phone/export`,
      method: 'POST',
	  data,
      custom: {
        showLoading: false, // 加载中
        showError: true, // 展示错误提示
      },
    })
  },
}
export default TaskApi;