package cn.superdesk.uniorder.common.enums.common;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;


/**
 * @Description: 软删除:0-正常;1-删除;4-临时;
 * @Author: linjinyu
 * @CreateDate: 2020/12/17 上午11:47
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020/12/17 上午11:47
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonSoftDeleteEnum {

    正常(0, "正常"),
    删除(1, "删除"),
    临时(4, "临时"),

    ;

    private Integer key;
    private String  desc;

    CommonSoftDeleteEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public Integer getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(Integer key) {
        for (CommonSoftDeleteEnum c : CommonSoftDeleteEnum.values()) {
            if (c.key.equals(key)) {
                return c.getDesc();
            }
        }
        return null;
    }

    private static final Map<Integer, CommonSoftDeleteEnum> LOOKUP = new HashMap<>();

    static {
        for (CommonSoftDeleteEnum s : EnumSet.allOf(CommonSoftDeleteEnum.class)) {
            LOOKUP.put(s.getKey(), s);
        }
    }

    public static CommonSoftDeleteEnum get(Integer key) {
        return LOOKUP.get(key);
    }

}
