package com.ruoyi.database.enums;


import lombok.Getter;

@Getter
public enum LoginType {
    WECHAT("wechat", "微信登录"),
    ALIPAY("alipay", "支付宝登录");

    private final String code;
    private final String description;

    LoginType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     */
    public static LoginType getByCode(String code) {
        for (LoginType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("不支持的登录方式: " + code);
    }
}
