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

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotStatusDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotTransferDTO;
import cn.iocoder.yudao.module.system.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = ApiConstants.NAME) // TODO 芋艿：fallbackFactory =
@Tag(name = "RPC 服务 - 远遥车辆相关")
public interface RemoteRobotApi {

    String PREFIX = ApiConstants.PREFIX + "/remote";

    @PostMapping(PREFIX + "/remoteGetAreaRobot")
    @Operation(summary = "获取地图区域对应的机器人信息")
    List<RemoteRobotDTO> remoteGetAreaRobot(@RequestParam(value = "mapId") Long mapId);

    @PostMapping(PREFIX + "/remoteEmergencyStopOrRecovery")
    @Operation(summary = "一键急停or一键恢复地图上所有AGV")
    CommonResult<Boolean> remoteEmergencyStopOrRecovery(@RequestParam(value = "mapId") Long mapId, @RequestParam(value = "type") Integer type);

    @PostMapping(PREFIX + "/getRemoteRobotStatus")
    @Operation(summary = "获取机器人远遥模式/急停/协控状态")
    RemoteRobotStatusDTO getRemoteRobotStatus(@RequestParam(value = "ip") String ip);

    @PostMapping(PREFIX + "/robotStop")
    @Operation(summary = "暂停机器人")
    CommonResult<Boolean> robotStop(@RequestParam(value = "robotNo") String robotNo);

    @PostMapping(PREFIX + "/recovery")
    @Operation(summary = "恢复机器人")
    CommonResult<Boolean> recovery(@RequestParam(value = "robotNo") String robotNo);

    @PostMapping(PREFIX + "/robotChangeMode")
    @Operation(summary = "切换模式")
    CommonResult<RemoteRobotTransferDTO> robotChangeMode(@RequestParam(value = "remoteMode") Integer remoteMode,
                                                         @RequestParam(value = "ip") String ip,
                                                         @RequestParam(value = "robotNo") String robotNo,
                                                         @RequestParam(value = "remoteControllerPort") int remoteControllerPort,
                                                         @RequestParam(value = "remoteControllerIp") String remoteControllerIp);

    @PostMapping(PREFIX + "/getRemotePositionMapList")
    @Operation(summary = "远遥查询地图")
    Object getRemotePositionMapList();

    @PostMapping(PREFIX + "/remoteDisconnect")
    @Operation(summary = "断开连接")
    CommonResult<RemoteRobotTransferDTO> remoteDisconnect(@RequestParam(value = "remoteIp") String remoteIp);

    @PostMapping(PREFIX + "/remoteTaskDone")
    @Operation(summary = "任务完成/取货完成")
    CommonResult<Boolean> remoteTaskDone(@RequestParam(value = "remoteIp") String remoteIp, @RequestParam(value = "mode") Integer mode);

    @PostMapping(PREFIX + "/getMacByRobotNo")
    @Operation(summary = "根据车辆编号获取MAC地址")
    String getMacByRobotNo( @RequestParam(value = "robotNo") String robotNo);

    @PostMapping(PREFIX + "/getRobotNoByMac")
    @Operation(summary = "根据车辆MAC地址获取车辆编号")
    String getRobotNoByMac( @RequestParam(value = "mac") String mac);
}
