package shop.alien.storeplatform.enums;

/**
 * 平台操作记录模块枚举
 *
 * @author system
 * @since 2025-01-XX
 */
public enum PlatformOperationModule {
    ACCOUNT("ACCOUNT", "账号操作记录"),
    ROLE("ROLE", "角色操作记录");

    private final String code;
    private final String moduleName;

    PlatformOperationModule(String code, String moduleName) {
        this.code = code;
        this.moduleName = moduleName;
    }

    public String getCode() {
        return code;
    }

    public String getModuleName() {
        return moduleName;
    }

    public static PlatformOperationModule fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (PlatformOperationModule module : values()) {
            if (module.code.equalsIgnoreCase(code)) {
                return module;
            }
        }
        return null;
    }
}
