import { defHttp } from '@/utils/http/axios';

enum Api{ 

    // 任务
    GetTaskPageList = '/api/Manage/GetTaskPageList',
    AddTask = '/api/Manage/AddTask',
    EditTask = '/api/Manage/EditTask',
    DeleteTask = '/api/Manage/DeleteTask',
    ExecuteFlyTask = '/api/Manage/ExecuteFlyTask',
    PendingFlyTask = '/api/Manage/PendingFlyTask',

    // 无人机
    GetUavPageList = '/api/Manage/GetUavPageList',
    
    // 无人机机场
    GetPortList = '/api/Manage/GetDataList',

    // 航线
    GetAirLineList =  '/api/Manage/GetAirLineList',
    AddAirLine = '/api/Manage/AddAirLine',
    EditAirLine = '/api/Manage/EditAirLine',
    GetAirLine = '/api/Manage/GetAirLine',
    DeleteAirLine = '/api/Manage/DeleteAirLine',
    UploadXmlFile = '/api/Manage/UploadXmlFile/upload'

}

// 任务
export function getTaskPageList(params) {
  return defHttp.get({ url: Api.GetTaskPageList, params });
}

export function addTask(params){
  return defHttp.post({ url: Api.AddTask, params });
}

export function editTask(params){
    return defHttp.post({ url: Api.EditTask, params });
}

export function deleteTask(params){
    return defHttp.post({ url: Api.DeleteTask+"?id="+params.id, params });
}

export function executeFlyTask(params){
  return defHttp.post({ url: Api.ExecuteFlyTask+"?taskId="+params.id, params });
}

export function pendingFlyTask(params){
  return defHttp.post({ url: Api.PendingFlyTask+"?taskId="+params.id, params });
}


// 无人机
export function getUavPageList(params) {
  return defHttp.get({ url: Api.GetUavPageList, params });
}

// 机场
export function getPortList(params) {
  return defHttp.get({ url: Api.GetPortList, params });
}

// 航线
export function getAirLineList(params) {
  return defHttp.get({ url: Api.GetAirLineList, params });
}

export function addAirLine(params){
  return defHttp.post({ url: Api.AddAirLine, params });
}

export function editAirLine(params){
  return defHttp.post({ url: Api.EditAirLine, params });
}

export function getAirLine(params) {
  return defHttp.get({ url: Api.GetAirLine, params });
}


export function uploadXmlFile(params){
  return defHttp.post({ url: Api.UploadXmlFile, params,headers: {'Content-Type': 'multipart/form-data' }});
}

export function deleteAirLine(params){
  return defHttp.post({ url: Api.DeleteAirLine+"?id="+params.id, params });
}


