package com.ningdatech.pmapi.expert.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author liuxinxin
 * @date 2022/8/4 上午11:14
 */
@AllArgsConstructor
@Getter
public enum QueryExpertAccountStatusEnum {


    /**
     * 冻结中
     */
    FREEZING("freezing"),

    /**
     * 正常
     */
    NORMAL("normal");

    private final String key;

    public static boolean contains(String key) {
        if (StringUtils.isBlank(key)) {
            return false;
        }
        for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) {
            if (statusEnum.key.equals(key)) {
                return true;
            }
        }
        return false;
    }


    public static QueryExpertAccountStatusEnum of(String key) {
        for (QueryExpertAccountStatusEnum statusEnum : QueryExpertAccountStatusEnum.values()) {
            if (statusEnum.key.equals(key)) {
                return statusEnum;
            }
        }
        throw new IllegalArgumentException(String.format("Illegal QueryExpertAccountStatusEnum = %s", key));
    }
}
