/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.Component
 *  com.l7tech.objectmodel.Goid
 *  org.jetbrains.annotations.Nullable
 *  org.springframework.context.ApplicationEvent
 */
package com.l7tech.server.event.system;

import com.l7tech.gateway.common.Component;
import com.l7tech.objectmodel.Goid;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.logging.Level;
import org.jetbrains.annotations.Nullable;
import org.springframework.context.ApplicationEvent;

public abstract class SystemEvent
extends ApplicationEvent {
    private static final String MY_IP;
    private final Component component;
    private final String ipAddress;
    private final Level level;
    private final String message;
    private final Goid identityProviderOid;
    private final String userName;
    private final String userId;
    static final long serialVersionUID = 2282808040237391809L;
    private static final String a;

    private static String getIp() {
        try {
            return InetAddress.getLocalHost().getHostAddress();
        }
        catch (UnknownHostException unknownHostException) {
            return a;
        }
    }

    public SystemEvent(Object object, Component component) {
        this(object, component, null, Level.INFO);
    }

    public SystemEvent(Object object, Component component, @Nullable String string, Level level) {
        this(object, component, string, level, null, null, null, null);
    }

    public SystemEvent(Object object, Component component, @Nullable String string, Level level, String string2) {
        this(object, component, string, level, string2, null, null, null);
    }

    public SystemEvent(Object object, Component component, @Nullable String string, Level level, String string2, Goid goid, String string3, String string4) {
        super(object);
        this.component = component;
        this.level = level;
        if (string == null) {
            string = MY_IP;
        }
        this.ipAddress = string;
        this.message = string2;
        this.identityProviderOid = goid;
        this.userName = string3;
        this.userId = string4;
    }

    public abstract String getAction();

    public String getMessage() {
        return this.message != null ? this.message : this.component.getName() + " " + this.getAction();
    }

    public Component getComponent() {
        return this.component;
    }

    public String getIpAddress() {
        return this.ipAddress;
    }

    public Level getLevel() {
        return this.level;
    }

    public Goid getIdentityProviderOid() {
        return this.identityProviderOid;
    }

    public String getUserName() {
        return this.userName;
    }

    public String getUserId() {
        return this.userId;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        a = SystemEvent.a(10, SystemEvent.a("i3\fewz%;x"));
        MY_IP = SystemEvent.getIp();
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x58);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 95;
                    case 1 -> 76;
                    case 2 -> 104;
                    case 3 -> 4;
                    case 4 -> 19;
                    case 5 -> 31;
                    default -> 88;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

