package cn.iocoder.yudao.module.system.enums.path;

import cn.iocoder.yudao.module.system.enums.robot.RobotTaskTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ROBOT_MAC_ADDRESS_EXISTS;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.TASK_TYPE_UN_EXIST;

@Getter
@AllArgsConstructor
public enum PathTaskTypeToRobotEnum {
    PICK_UP_GOODS("PICK_UP_GOODS","取货"),
    DROP_OFF_GOODS("DROP_OFF_GOODS","放货"),
    MOVE("MOVE","移动"),
    AUTO_CHARGE("AUTO_CHARGE","自动充电"),
    MANUAL_CHARGE("MANUAL_CHARGE","手动充电");
    /**
     * 类型
     */
    private final String type;

    private final String msg;

    /**
     * 任务对应的类型
     * @param taskType
     * @return
     */
    public static String taskDetailGetType(Integer taskType) {
        if (RobotTaskTypeEnum.TAKE_RELEASE.getType().equals(taskType)) {
            return PICK_UP_GOODS.getType();
        }else if (RobotTaskTypeEnum.MOVE.getType().equals(taskType) || RobotTaskTypeEnum.MOVE_TO_POINT.getType().equals(taskType) ) {
            return MOVE.getType();
        }else if (RobotTaskTypeEnum.TAKE.getType().equals(taskType)) {
            return PICK_UP_GOODS.getType();
        }else if (RobotTaskTypeEnum.RELEASE.getType().equals(taskType)) {
            return DROP_OFF_GOODS.getType();
        }else if (RobotTaskTypeEnum.PARK.getType().equals(taskType)) {
            return MOVE.getType();
        }
        throw exception(TASK_TYPE_UN_EXIST);
    }
}
