package com.muyu.cloud.vehicle.gateway.controller;


import com.muyu.cloud.vehicle.gateway.domain.model.MqttServerModel;
import com.muyu.cloud.vehicle.gateway.domain.req.VehicleConnectionReq;
import com.muyu.cloud.vehicle.gateway.service.VehicleConnectionService;
import com.muyu.common.core.domain.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
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;

/**
 *
 * 车辆连接控制器
 */
@Log4j2
@RestController
@RequestMapping("/vehicleGateway")
@Tag(name = "连接车辆控制层")
public class VehicleConnectionController {

    @Autowired
    private VehicleConnectionService vehicleConnectionService;


    /**
     * 获取http连接的参数
     * @param vehicleConnectionReq
     * @return
     */
    @PostMapping("/receiveMsg/connect")
    public Result<MqttServerModel> receiveMsg(@RequestBody VehicleConnectionReq vehicleConnectionReq){
        log.info("===============>"+vehicleConnectionReq);
        return vehicleConnectionService.getConnect(vehicleConnectionReq);
    }
}
