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

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

/**
 * @Description: 表单状态:1-预览;2-提交;
 * @Author: linjinyu
 * @CreateDate: 2022/4/18 5:27 下午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/4/18 5:27 下午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonFormStateEnum {


    预览(1, "预览"),
    提交(2, "提交"),
    ;

    private Integer key;
    private String  desc;

    CommonFormStateEnum(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 (CommonFormStateEnum c : CommonFormStateEnum.values()) {
            if (c.key.equals(key)) {
                return c.getDesc();
            }
        }
        return null;
    }

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

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

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