package com.pangu.member.enums;

/**
 * 注册来源枚举
 * @author pangu
 */
public enum RegisterSourceEnum {

    MINI_PROGRAM("1", "小程序"),
    H5("2", "H5"),
    BACKEND("3", "后台新增"),
    IMPORT("4", "批量导入");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据代码获取名称
     */
    public static String getNameByCode(String code) {
        for (RegisterSourceEnum source : values()) {
            if (source.getCode().equals(code)) {
                return source.getName();
            }
        }
        return "";
    }
}
