package com.prolog.eis.enums.base;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @program: eis-dsl-parent
 * @description: 通用状态
 * @author: Xiong
 * @create: 2021-12-30 17:28
 **/
@Getter
@AllArgsConstructor
public enum LayerEnum {

    ONE(1, "一楼"),
    TWO(2, "二楼"),
    ;
    private Integer code;
    private String msg;

    private static Map<Integer, LayerEnum> cache;

    static {
        cache = Arrays.stream(LayerEnum.values()).collect(Collectors.toMap(LayerEnum::getCode, Function.identity()));
    }

    public static LayerEnum of(Integer code) {
        return cache.get(code);
    }
}
