import { defAxios as request } from '@/utils/http'

/**
 * 任务查询
 * @returns
 */
export const getTaskList = params => request({
  url: '/task/getTaskList',
  method: 'GET',
  params
})

/**
 * 任务详情
 * @param {*} params id
 * @returns
 */
export const getTaskInfo = params => request({
  url: `/task/getInfo/${params}`,
  method: 'GET'
})

/**
 * 获取飞手列表
 * @returns
 */
export const getTaskPilot = () => request({
  url: '/task/getPilot',
  method: 'GET'
})

/**
 * 添加任务
 * @param {*} params
 * @returns
 */
export const taskAdd = data => request({
  url: '/task/add',
  method: 'POST',
  data
})

/**
 * 编辑任务
 * @param {*} params
 * @returns
 */
export const taskEdit = data => request({
  url: '/task/edit',
  method: 'PUT',
  data
})

/**
 * 删除任务
 * @param {*} params
 * @returns
 */
export const taskDel = params => request({
  url: `/task/delete/${params}`,
  method: 'DELETE'
})

/**
 * 分配飞手
 * @param {*} params
 * @returns
 */
export const distributionPilot = data => request({
  url: '/task/distributionPilot',
  method: 'PUT',
  data
})

/**
 * 飞手接单
 * @param {*} params
 * @returns
 */
export const pilotOrder = data => request({
  url: '/task/pilotOrder',
  method: 'PUT',
  data
})

/**
 * 开始飞行
 * @param {*} params
 * @returns
 */
export const pilotStart = data => request({
  url: '/task/pilotStart',
  method: 'PUT',
  data
})

/**
 * 结束飞行
 * @param {*} params
 * @returns
 */
export const pilotEnd = data => request({
  url: '/task/pilotEnd',
  method: 'PUT',
  data
})

/**
 * 上传飞行文件
 * @param {*} params
 * @returns
 */
export const uploadFlightUrl = data => request({
  url: '/task/uploadFlightUrl',
  method: 'PUT',
  data
})

/**
 * 平台列表
 * @param {*} params
 * @returns
 */
export const PilotPlatform = () => request({
  url: '/PilotPlatform/index',
  method: 'GET'
})
