package com.muyu.cargateway.controller;

import com.muyu.cargateway.domain.model.MqttServerModel;
import com.muyu.cargateway.domain.req.VehicleConnectionReq;
import com.muyu.cargateway.service.CarOneClickOperationService;
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;

/**
 * @ Tool：IntelliJ IDEA
 * @ Author：CHX
 * @ Date：2024-09-26-20:14
 * @ Version：1.0
 * @ Description：车辆
 * @author Lenovo
 */
@Log4j2
@RestController
@RequestMapping("/vehicleGateway")
@Tag(name = "连接车辆控制层")
public class CarOneClickOperationController {
   @Autowired
    private CarOneClickOperationService carOneClickOperationService;

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