package cn.iocoder.yudao.module.remote.api.path;

import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotWirelessSignalDTO;
import cn.iocoder.yudao.module.remote.service.robot.RemoteRobotService;
import cn.iocoder.yudao.module.remote.util.redis.RedisUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class RemotePathApiImpl implements RemotePathApi{

    @Autowired
    private RemoteRobotService remoteRobotService;



    /**
     * 远遥推送车辆将要行走的路径
     * @param message
     */
    @Override
    public void remoteDistanceInformation(String message) {
        RemoteRobotDistanceInformationDTO data = JSON.parseObject(message, RemoteRobotDistanceInformationDTO.class);
        remoteRobotService.remoteDistanceInformation(data);
    }

    /**
     * 车辆信号信息
     * @param message
     */
    @Override
    public void wirelessSignalStatus(String message) {
        RemoteRobotWirelessSignalDTO data = JSON.parseObject(message, RemoteRobotWirelessSignalDTO.class);
        remoteRobotService.sendRobotWirelessSignalStatus(data);
    }


}
