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

/**
 * @description: 分页查询任务列表
 * @return {*}
 */
export function allTaskList(params) {
  return request({
    url: '/inspection/findList',
    method: 'get',
    params
  })
}
/**
 * @description: 查询飞行坐标数据
 * @return {*}
 */
export function getCoordinate(id) {
  return request({
    url: `/flightdata/getFlightDataList?inspectionId=${id}`,
    method: 'get'
  })
}
/**
 * @description: 创建任务
 * @return {*}
 */
export function taskCreate(data) {
  return request({
    url: '/inspection/addThInspection',
    method: 'post',
    data
  })
}

/**
 * @description: 获取全部河流列表
 * @return {*}
 */
export function allRivers() {
  return request({
    url: '/stream/getList',
    method: 'get'
  })
}

/**
 * @description: 获取任务详情
 * @return {*}
 */
export function taskDetail(id) {
  return request({
    url: `/inspection/findById?id=${id}`,
    method: 'get'
  })
}

/**
 * @description: 更新任务信息
 * @return {*}
 */
export function taskUpdate(data) {
  return request({
    url: '/inspection/updateById',
    method: 'post',
    data
  })
}

/**
 * @description: 删除任务
 * @return {*}
 */
export function taskDelete(ids) {
  return request({
    url: `/inspection/deleteBatch/?idList=${ids} `,
    method: 'delete'
  })
}

/**
 * @description: 生成巡河报告
 * @return {*}
 */
export function createStreamReport(id) {
  return request({
    url: `/reportPatrol/generateReport?inspectionId=${id}`,
    method: 'get'
  })
}

/**
 * @description: 生成巡检报告
 * @return {*}
 */
export function createReport(id) {
  return request({
    url: `/report/generateReport?inspectionId=${id}`,
    method: 'get'
  })
}

/**
 * @description: 审核任务
 * @return {*}
 */
export function taskApprove(data) {
  return request({
    url: '/inspection/checkById',
    method: 'post',
    data
  })
}

