package com.prolog.rdc.tms.controller;

import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;
import com.prolog.rdc.tms.model.dto.e6.EquipInfoDTO;
import com.prolog.rdc.tms.model.dto.e6.EquipInfoHistoryDTO;
import com.prolog.rdc.tms.model.dto.e6.TrackDetailDTO;
import com.prolog.rdc.tms.model.dto.e6.VehicleInfoDTO;
import com.prolog.rdc.tms.model.dto.e6.VehicleTemperatureInfoDTO;
import com.prolog.rdc.tms.model.dto.e6.VehiclesAllAlarmInfoDTO;
import com.prolog.rdc.tms.model.vo.e6.EquipInfoHistoryVO;
import com.prolog.rdc.tms.model.vo.e6.EquipInfoVO;
import com.prolog.rdc.tms.model.vo.e6.TrackDetailVO;
import com.prolog.rdc.tms.model.vo.e6.VehicleInfoVO;
import com.prolog.rdc.tms.model.vo.e6.VehicleTemperatureInfoVO;
import com.prolog.rdc.tms.model.vo.e6.VehiclesAllAlarmInfoVO;
import com.prolog.rdc.tms.service.E6GpsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @author hongbo.pan
 * @date 2023/3/21
 */
@Api(tags = "易流接口控制层")
@RestController
@RequestMapping("/e6Gps")
public class E6GpsController {

    @Autowired
    private E6GpsService service;

    @UserLog("获取车辆的最新位置信息")
    @ApiOperation(value = "获取车辆的最新位置信息", notes = "获取车辆的最新位置信息")
    @PostMapping("/getVehicleInfo")
    public RestMessage<List<VehicleInfoDTO>> getVehicleInfo(@RequestBody @Valid VehicleInfoVO vo) {
        return RestMessage.newInstance(true, "查询成功", service.getVehicleInfo(vo));
    }

    @UserLog("获取车辆的轨迹信息")
    @ApiOperation(value = "获取车辆的轨迹信息", notes = "获取车辆的轨迹信息")
    @PostMapping("/getTrackDetail")
    public RestMessage<List<TrackDetailDTO>> getTrackDetail(@RequestBody @Valid TrackDetailVO vo) {
        return RestMessage.newInstance(true, "查询成功", service.getTrackDetail(vo));
    }

    @UserLog("查询车辆的温度信息")
    @ApiOperation(value = "查询车辆的温度信息", notes = "查询车辆的温度信息")
    @PostMapping("/getVehicleTemperatureInfo")
    public RestMessage<List<VehicleTemperatureInfoDTO>> getVehicleTemperatureInfo(@RequestBody @Valid VehicleTemperatureInfoVO vo) {
        return RestMessage.newInstance(true, "查询成功", service.getVehicleTemperatureInfo(vo));
    }

    @UserLog("查询车辆报警和异常信息")
    @ApiOperation(value = "查询车辆报警和异常信息", notes = "查询车辆报警和异常信息")
    @PostMapping("/getVechilesAllAlarmInfo")
    public RestMessage<List<VehiclesAllAlarmInfoDTO>> getVechilesAllAlarmInfo(@RequestBody @Valid VehiclesAllAlarmInfoVO vo) {
        return RestMessage.newInstance(true, "查询成功", service.getVechilesAllAlarmInfo(vo));
    }

    @UserLog("设备实时数据查询")
    @ApiOperation(value = "设备实时数据查询", notes = "设备实时数据查询")
    @PostMapping("/getEquipInfoReal")
    public RestMessage<List<EquipInfoDTO>> getEquipInfoReal(@RequestBody @Valid EquipInfoVO vo) {
        return RestMessage.newInstance(true, "查询成功", service.getEquipInfoReal(vo));
    }

    @UserLog("设备轨迹数据查询")
    @ApiOperation(value = "设备轨迹数据查询", notes = "设备轨迹数据查询")
    @PostMapping("/getEquipInfoHistory")
    public RestMessage<List<EquipInfoHistoryDTO>> getEquipInfoHistory(@RequestBody @Valid EquipInfoHistoryVO vo) {
        return RestMessage.newInstance(true, "查询成功", service.getEquipInfoHistory(vo));
    }
}
