package com.ningdatech.carapi.radar.controller;

import com.ningdatech.carapi.radar.manage.RadarManage;
import com.ningdatech.carapi.radar.model.vo.RadarObjectDataVO;
import com.ningdatech.carapi.radar.model.vo.RadarTrafficFlowDataVO;
import com.ningdatech.carapi.road.model.req.RoadMonitorReq;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author PoffyZhang
 * @since 2022-10-09
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/radar")
@RequiredArgsConstructor
public class RadarController {

    private final RadarManage radarManage;

    @ApiOperation(value = "客户端-雷达监听连接测试", notes = "客户端-雷达监听连接测试")
    @GetMapping("/get-radar-data-as-client")
    public String getRadarDataAsClient() {
        return radarManage.getRadarDataAsClient();
    }

    @ApiOperation(value = "服务端-雷达监听连接测试", notes = "服务端-雷达监听连接测试")
    @GetMapping("/get-radar-data-as-server")
    public String getRadarDataAsServer() {
        return radarManage.getRadarDataAsServer();
    }

    @ApiOperation(value = "工作台雷达交通流量数据", notes = "工作台雷达交通流量数据")
    @GetMapping("/workbench/radar-traffic-flow-data")
    public RadarTrafficFlowDataVO workbenchRadarTrafficFlowData(RoadMonitorReq req) {
        return radarManage.workbenchRadarTrafficFlowData(req);
    }

    @ApiOperation(value = "道路监控驾驶舱雷达交通流量数据", notes = "道路监控驾驶舱雷达交通流量数据")
    @GetMapping("/radar-traffic-flow-data")
    public RadarTrafficFlowDataVO radarTrafficFlowData(RoadMonitorReq req) {
        return radarManage.radarTrafficFlowData(req);
    }

    @ApiOperation(value = "道路监控驾驶舱雷达目标轨迹数据", notes = "道路监控驾驶舱雷达目标轨迹数据")
    @GetMapping("/radar-object-data")
    public List<RadarObjectDataVO> radarObjectData(RoadMonitorReq req) {
        return radarManage.radarObjectData(req);
    }
}
