package com.keystar.plane.inspection.controller;

import com.keystar.plane.inspection.bo.DateBo;
import com.keystar.plane.inspection.bo.PlaneInspectionBo;
import com.keystar.plane.inspection.dao.NestStatusVo;
import com.keystar.plane.inspection.mqtt.PlaneMqttHandler;
import com.keystar.plane.inspection.service.LoginService;
import com.keystar.plane.inspection.service.NestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/nest")
public class NestController {

    @Autowired
    NestService nestService;

    @Autowired
    LoginService loginService;

    /**
     *  获取机巢的具体状态
     **/
    @GetMapping("/getNestStatus")
    public String getNestStatus(){
        return nestService.getNestStatus();
    }

    /**
     *  获取机巢是否在线
     **/
    @GetMapping("/getNestOnline")
    public NestStatusVo getNestOnline(){
        return nestService.getNestOnline();
    }

    /**
     *  获取最新的无人机巡检信息
     **/
    @GetMapping("/getPhoto")
    public String getNestMsg() throws Exception {
        return PlaneMqttHandler.getPlanePhoto();
    }

    /**
     *  获取无人机的任务信息
     **/
    @PostMapping("/getTask")
    public PlaneInspectionBo getInspection(@RequestBody DateBo dateBo) throws Exception {
        return nestService.getInspection(dateBo);
    }
}
