package com.diagbot.enums;

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

/**
 * @Description:用户验证处理状态
 * @Author:zhaops
 * @time: 2018/10/22 16:34
 */
public enum AuthHandleEnum implements KeyedNamed {
    UNHandle(0, "未处理"),
    Handled(1, "已处理");

    @Setter
    private Integer key;

    @Setter
    private String name;

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

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

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

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

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