package com.ningdatech.carapi.road.controller;

import com.ningdatech.carapi.road.manage.RoadMonitorManage;
import com.ningdatech.carapi.road.model.req.RoadMonitorReq;
import com.ningdatech.carapi.road.model.req.VideoDownloadReq;
import com.ningdatech.carapi.road.model.vo.ComprehensiveSituationVO;
import com.ningdatech.carapi.road.model.vo.RoadDangerBehaviorVO;
import com.ningdatech.log.annotation.WebLog;
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 javax.servlet.http.HttpServletResponse;
import java.util.List;

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

    private final RoadMonitorManage roadMonitorManage;

    @ApiOperation(value = "综合态势数据", notes = "综合态势数据")
    @GetMapping("/get-comprehensive-situation-data")
    public ComprehensiveSituationVO getComSitData(RoadMonitorReq req) {
        return roadMonitorManage.getComSitData(req);
    }

    @ApiOperation(value = "危险行为数据", notes = "危险行为数据")
    @GetMapping("/get-road-danger-behavior-data")
    public List<RoadDangerBehaviorVO> getRoadDangerBehaviorData(RoadMonitorReq req) {
        return roadMonitorManage.getRoadDangerBehaviorData(req);
    }

    @ApiOperation(value = "违法违章与预警记录数据", notes = "违法违章与预警记录列表")
    @GetMapping("/get-violation-warn-record-data")
    public List<RoadDangerBehaviorVO> getViolationWarnRecordData(RoadMonitorReq req) {
        return roadMonitorManage.getViolationWarnRecordData(req);
    }

    @GetMapping("/video/download")
    @ApiOperation("视频下载")
    @WebLog("视频下载")
    public void downloadOperationManual(VideoDownloadReq req, HttpServletResponse response){
        roadMonitorManage.videoDownload(req,response);
    }
}
