package com.microservices.common.core.enums;

import lombok.Getter;

/**
 * 用户身份状态
 *
 * @author OTTO
 */
@Getter
public enum UserIdentityStatus {
    NORMAL("normal", "正常"),
    QUIT("quit", "离职"),
    DELETE("delete", "已注销");
    private final String state;
    private final String info;

    UserIdentityStatus(String state, String info) {
        this.state = state;
        this.info = info;
    }

    /**
     * 获取非正常状态
     *
     * @param state 状态值
     * @return 状态
     */
    public static UserIdentityStatus getNonNormalState(String state) {
        for (UserIdentityStatus status : values()) {
            if (status == QUIT && status.state.equals(state)) {
                return status;
            }
        }
        return null;
    }

    public String getStateInfo() {
        return "(" + this.getInfo() + ")";
    }
}
