/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.Component
 *  com.l7tech.gateway.common.audit.SystemAuditRecord
 */
package com.l7tech.server.event.system;

import com.l7tech.gateway.common.Component;
import com.l7tech.gateway.common.audit.SystemAuditRecord;
import com.l7tech.server.event.system.SystemEvent;
import java.util.logging.Level;

public class AuditPurgeEvent
extends SystemEvent {
    private static final Component COMPONENT;
    private static final String NAME;
    private final int numDeleted;
    private final boolean update;
    private SystemAuditRecord systemAuditRecord;
    static final long serialVersionUID = 3244083925753146758L;
    private static final String[] b;

    public AuditPurgeEvent(Object object, int n2) {
        super(object, COMPONENT, null, Level.INFO, AuditPurgeEvent.buildMessage(n2));
        this.numDeleted = n2;
        this.update = false;
    }

    public AuditPurgeEvent(Object object, SystemAuditRecord systemAuditRecord, int n2) {
        super(object, COMPONENT, null, Level.INFO, AuditPurgeEvent.buildMessage(n2));
        this.numDeleted = n2;
        this.update = true;
        systemAuditRecord.setAction(AuditPurgeEvent.buildAction(n2));
        systemAuditRecord.setMessage(AuditPurgeEvent.buildMessage(n2));
        systemAuditRecord.setMillis(System.currentTimeMillis());
        this.setSystemAuditRecord(systemAuditRecord);
    }

    public boolean isUpdate() {
        return this.update;
    }

    @Override
    public String getAction() {
        return AuditPurgeEvent.buildAction(this.numDeleted);
    }

    public static String buildAction(int n2) {
        String[] stringArray = b;
        return stringArray[2] + n2 + stringArray[0];
    }

    public static String buildMessage(int n2) {
        return COMPONENT.getName() + " " + AuditPurgeEvent.buildAction(n2);
    }

    public SystemAuditRecord getSystemAuditRecord() {
        return this.systemAuditRecord;
    }

    public void setSystemAuditRecord(SystemAuditRecord systemAuditRecord) {
        this.systemAuditRecord = systemAuditRecord;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "|<e\u001fPr-.\u0018s\u0014Kb~\u0006\f\bb\u001c\\b\u0007\f\bb\u001c\\b-";
        int n3 = "|<e\u001fPr-.\u0018s\u0014Kb~\u0006\f\bb\u001c\\b\u0007\f\bb\u001c\\b-".length();
        int n4 = 14;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = AuditPurgeEvent.b(106, AuditPurgeEvent.b(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                b = stringArray;
                NAME = b[1];
                COMPONENT = Component.GW_AUDIT_SYSTEM;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(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 -> 54;
                    case 1 -> 23;
                    case 2 -> 122;
                    case 3 -> 17;
                    case 4 -> 83;
                    case 5 -> 108;
                    default -> 103;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

