package com.ruoyi.enums.sms;

import lombok.Getter;

import java.util.Arrays;

/**
 * 短信枚举
 * @Author liwenlong
 */
@Getter
public enum SmsEnums {

    REGISTER(1, "用户注册"),
    LOGIN(2, "用户登录"),
    CHANGE_PWD(3, "修改密码"),
    FORGET_PWD(4, "忘记密码"),
    WX_APPLET_LOGIN_BIND(5, "小程序登录绑定手机号"),
    WX_LOGIN_BIND(6, "微信登录绑定手机号"),
    APPLE_BIND(7, "苹果登录绑定手机号"),
    PAY_PWD(8, "支付密码校验"),
    OLD_MOBILE_BIND(9, "换绑手机号-验证原有手机号"),
    NEW_MOBILE_BIND(10, "换绑手机号-验证新手机号"),

    ;

    private final Integer code;
    private final String name;

    public static String getName(Integer code) {
       return getSmsEnums(code).name;
    }

    public static SmsEnums getSmsEnums(Integer code) {
        return Arrays.stream(SmsEnums.values()).filter(c->c.getCode().equals(code)).findFirst().get();
    }

    SmsEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }


}
