package com.diagbot.enums;

import com.diagbot.core.KeyedNamed;
import lombok.Setter;

/**
 * @Description:认证状态枚举类
 * @author: zhaops
 * @time: 2018/9/17 20:25
 */
public enum RejectEnum implements KeyedNamed {

    NO_PASS(0, "未通过"),
    PASS(1, "已通过");

    @Setter
    private Integer key;

    @Setter
    private String name;

    RejectEnum(Integer key, String name) {
        this.key = key;
        this.name = name;
    }

    public static RejectEnum getEnum(Integer key) {
        for (RejectEnum item : RejectEnum.values()) {
            if (item.key == key) {
                return item;
            }
        }
        return null;
    }

    public static String getName(Integer key) {
        RejectEnum item = getEnum(key);
        return item != null ? item.name : null;
    }

    @Override
    public int getKey() {
        return key;
    }

    @Override
    public String getName() {
        return name;
    }
}
