package com.ningdatech.carapi.safe.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.safe.model.dto.OverspeedPageQuery;
import com.ningdatech.carapi.safe.manage.VehicleOverspeedManage;
import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedCompanyVO;
import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedVehicleVO;
import com.ningdatech.carapi.safe.model.vo.NdVehicleOverspeedWaysectionVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author PoffyZhang
 * @since 2022-10-12
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/api/safe/overspeed")
@Api(value = "Overspeed", tags = "安全管理-超速管理")
@RequiredArgsConstructor
public class NdVehicleOverspeedController {

    private final VehicleOverspeedManage vehicleOverspeedManage;

    @ApiOperation(value = "企业超速", notes = "企业超速")
    @GetMapping("/company")
    public PageVo<NdVehicleOverspeedCompanyVO> queryCompanyOverspeed(@Valid @ModelAttribute OverspeedPageQuery overspeedPageQuery) {
        return vehicleOverspeedManage.queryCompanyOverspeed(overspeedPageQuery);
    }

    @ApiOperation(value = "车辆超速", notes = "车辆超速")
    @GetMapping("/vehicle")
    public PageVo<NdVehicleOverspeedVehicleVO> queryVihicleOverspeed(@Valid @ModelAttribute OverspeedPageQuery overspeedPageQuery) {
        return vehicleOverspeedManage.queryVihicleOverspeed(overspeedPageQuery);
    }

    @ApiOperation(value = "超速路段分析", notes = "超速路段分析")
    @GetMapping("/waySection")
    public PageVo<NdVehicleOverspeedWaysectionVO> queryWaySectionOverspeed(@Valid @ModelAttribute OverspeedPageQuery overspeedPageQuery) {
        return vehicleOverspeedManage.queryWaySectionOverspeed(overspeedPageQuery);
    }
}
