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

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

/**
 * 审核结果
 * @author Homan Liang
 * @version 1.0
 * @date 2019/8/12
 */
public enum ApproveStatusEnum {

    APPROVE(1,"通过"),
    REJECT(2,"不通过"),
    ;

    private Integer key;
    private String desc;

    ApproveStatusEnum(int key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public int getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(int key) {
        for (ApproveStatusEnum c : ApproveStatusEnum.values()) {
            if (c.key == key) {
                return c.getDesc();
            }
        }
        return null;
    }

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

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

    /**
     * 方向查找枚举类
     * @param key
     * @return
     */
    public static ApproveStatusEnum get(Integer key) {
        return LOOKUP.get(key);
    }
}
