import { http } from '@/http/http'

enum Api {
  base = '/scheduleTasks/tasks',
  confirmBase = '/scheduleTasks/tasks/confirm',
  uploadBase = '/taskAttachment/attachment',
  photoBase = '/taskPhoto/photo',
  // 修改计划时间
  planTimeBase = '/scheduleTasks/tasks/setPlanTime',
}

/**
 * 修改计划时间
 * @param data
 * @returns
 */
export function setPlanTime(id: number, data: any) {
  return http.put(`${Api.planTimeBase}/${id}`, data)
}

export function transferTask(data: any) {
  return http.put(`${Api.base}/forward`, data)
}
// 关闭任务
export function closeTask(data: any) {
  return http.put(`${Api.base}/cancel`, data)
}

export function getTaskDetail(id: number) {
  return http.get(`${Api.base}/${id}`)
}

/**
 * 确认完成任务
 * @param id 任务id
 * @returns
 */
export function confirmDoneTask(id: number) {
  return http.put(`${Api.confirmBase}/${id}`)
}

/**
 * 处理任务附件
 * @param params
 * @returns
 */
export function dealUploadTask(params: any) {
  return http.put(`${Api.uploadBase}/handle`, params)
}

export function dealPhotoTask(params: any) {
  return http.put(`${Api.photoBase}/handle`, params)
}
