package cn.iocoder.yudao.module.remote.enums.robot;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Iterator;

@Getter
@AllArgsConstructor
public enum DirectionEnum {

    LEFT_FRONT("1", "左转"),
    RIGHT_FRONT("2", "右转"),
    RIGHT_IN_FRONT("3", "直走"),
    LEFT_REAR("4", "左后方方向转弯"),
    RIGHT_REAR("5", "右后方方向转弯"),
    RIGHT_BEHIND("6", "正后方方向"),
    END_POINT("7", "到达终点");

    /**
     * 类型
     */
    private final String type;
    /**
     * 说明
     */
    private final String msg;

    public static String getMsgByType(String code){
        Iterator<DirectionEnum> iterator = Arrays.stream(DirectionEnum.values()).iterator();
        while (iterator.hasNext()){
            DirectionEnum next = iterator.next();
            if(next.type.equals(code)){
                return next.getMsg() ;
            }
        }
        return null;
    }


}
