package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.request.airport.DroneControlRequest;
import com.tuoheng.admin.entity.request.airport.PointFlightRequest;
import com.tuoheng.admin.service.airport.AirportService;
import com.tuoheng.common.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 2023-02-10
 */
@Slf4j
@RestController
@RequestMapping("/airport")
public class AirPortController {

    @Autowired
    private AirportService airportService;

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

    /**
     * 定点飞行
     */
    @PostMapping("/pointflight")
    public JsonResult pointFlight(PointFlightRequest request) {
        return airportService.pointFlight(request);
    }

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

    /**
     * 操制无人机
     */
    @PostMapping("/drone/control")
    public JsonResult droneControl(DroneControlRequest request) {
        return airportService.droneControl(request);
    }
}
