package com.tuoheng.admin.controller;

import com.tuoheng.admin.dto.ReversalFlightDto;
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.*;

import java.util.List;

/**
 * 机场前端控制器
 *
 * @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
     * @return
     */
    @GetMapping("/line/list")
    public JsonResult getAirLineList(String sn,Long id) {
        return airportService.getAirLineList(sn,id);
    }
    /**
     * 获取机场详细信息
     * @param
     * @return
     */
    @GetMapping("/getAirportDetail/{sn}")
    public JsonResult getAirportDetail(@PathVariable("sn") String sn) {
        return airportService.getAirportDetail(sn);
    }

    /**
     * 根据巡检机场id获取机场内外监控视频
     * @param airportId
     * @return
     */
    @GetMapping("/getAirportVideo/{airportId}")
    public JsonResult getAirportVideo(@PathVariable("airportId") Integer airportId){
        log.info("进入获取无人机内外视频画面:airportId={}",airportId);
        return airportService.getAirportVideo(airportId);
    }


    /**
     * 无人机返仓
     * @param dto
     * @return
     */
    @PostMapping("/reversalFlight")
    public JsonResult reversalFlight(@RequestBody ReversalFlightDto dto){
        log.info("进入无人机返航接口:dto={}",dto);
        return airportService.reversalFlight(dto);
    }

}
