package com.tuoheng.admin.controller;

import com.tuoheng.admin.request.accident.AccidentFlightRequest;
import com.tuoheng.admin.request.accident.ReversalFlightRequest;
import com.tuoheng.admin.service.third.airport.AirportService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 机场前端控制器
 *
 * @author wanjing
 * @team tuoheng
 * @date 2022-11-23
 */
@Slf4j
@RestController
@RequestMapping("/airport")
public class AirPortController {

    @Autowired
    private AirportService airportService;

    /**
     * 获取巡检机场
     */
    @GetMapping("/list")
    public JsonResult getList() {
        return airportService.getAirportList();
    }

    /**
     * 获取巡检线路
     *
     * @param droneId 机场列表里面的droneId
     * @return
     */
    @GetMapping("/line/list/{droneId}")
    public JsonResult getAirLineList(@PathVariable("droneId") Integer droneId) {
        return airportService.getAirLineList(droneId);
    }

    /**
     * 无人机信息
     * @param airportId
     * @return
     */
    @GetMapping("/drone/data/{airportId}")
    public JsonResult getDroneDataById(@PathVariable("airportId") Integer airportId){
        return airportService.getDroneDataById(airportId);
    }

    /**
     * 应急飞行（起飞）
     * @param request
     * @return
     */
    @PostMapping("/pointFlight")
    public JsonResult pointFlight(AccidentFlightRequest request){
        return airportService.pointFlight(request);
    }

    /**
     * 应急飞行（回仓）
     * @param request
     * @return
     */
    @PostMapping("/reversalFlight")
    public JsonResult  reversalFlight(ReversalFlightRequest request){
        return airportService.reversalFlight(request);
    }



}
