package com.jiayue.ssi.backenum;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
* 密码规则枚举
*
* @author xsl
* @since 2023/06/06
*/
@Getter
@AllArgsConstructor
public enum PasswordRuleEnum {
    /**
     * 大写字母
     */
    A("大写字母", ".*[A-Z]+.*"),
    /**
     * 小写字母
     */
    B("小写字母", ".*[a-z]+.*"),
    /**
     * 数字
     */
    C("数字", ".*\\d+.*"),
    /**
     * 特殊字符
     */
    D("特殊字符", ".*[~!@#$%^&*()_+|<>,.?/:;'\\[\\]{}\"]+.*");

    private String code;
    private String message;

    public static PasswordRuleEnum getByName(String name) {
        for (PasswordRuleEnum type : values()) {
            if (type.name().equals(name)) {
                return type;
            }
        }
        return null;
    }
}
