package com.adobe.marketing.mobile;

import java.util.Arrays;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import wg.t;

/* loaded from: classes4.dex */
public final class Event {

    /* renamed from: a, reason: collision with root package name */
    private String f12162a;

    /* renamed from: b, reason: collision with root package name */
    private String f12163b;

    /* renamed from: c, reason: collision with root package name */
    private String f12164c;

    /* renamed from: d, reason: collision with root package name */
    private String f12165d;

    /* renamed from: e, reason: collision with root package name */
    private Map f12166e;

    /* renamed from: f, reason: collision with root package name */
    private long f12167f;

    /* renamed from: g, reason: collision with root package name */
    private String f12168g;

    /* renamed from: h, reason: collision with root package name */
    private String f12169h;

    /* renamed from: i, reason: collision with root package name */
    private String[] f12170i;

    /* loaded from: classes4.dex */
    public static class Builder {

        /* renamed from: a, reason: collision with root package name */
        private final Event f12171a;

        /* renamed from: b, reason: collision with root package name */
        private boolean f12172b;

        public Builder(String str, String str2, String str3) {
            this(str, str2, str3, null);
        }

        private void i() {
            if (this.f12172b) {
                throw new UnsupportedOperationException("Event - attempted to call methods on Event.Builder after build() was called");
            }
        }

        public Event a() {
            i();
            this.f12172b = true;
            if (this.f12171a.f12165d == null || this.f12171a.f12164c == null) {
                return null;
            }
            if (this.f12171a.f12167f == 0) {
                this.f12171a.f12167f = System.currentTimeMillis();
            }
            return this.f12171a;
        }

        public Builder b(Event event) {
            i();
            if (event == null) {
                throw new NullPointerException("parentEvent cannot be null");
            }
            this.f12171a.f12169h = event.x();
            return this;
        }

        public Builder c(Event event) {
            i();
            if (event == null) {
                throw new NullPointerException("requestEvent is null");
            }
            f(event.f12163b);
            b(event);
            return this;
        }

        public Builder d(Map map) {
            i();
            try {
                this.f12171a.f12166e = ch.d.f(map);
            } catch (Exception e10) {
                t.f("MobileCore", "EventBuilder", "Event data couldn't be serialized, empty data was set instead %s", e10);
            }
            return this;
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        public Builder e(String str) {
            i();
            this.f12171a.f12169h = str;
            return this;
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        public Builder f(String str) {
            i();
            this.f12171a.f12168g = str;
            return this;
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        public Builder g(long j10) {
            i();
            this.f12171a.f12167f = j10;
            return this;
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        public Builder h(String str) {
            if (str == null) {
                return this;
            }
            i();
            this.f12171a.f12163b = str;
            return this;
        }

        public Builder(String str, String str2, String str3, String[] strArr) {
            Event event = new Event();
            this.f12171a = event;
            event.f12162a = str;
            event.f12163b = UUID.randomUUID().toString();
            event.f12165d = str2;
            event.f12164c = str3;
            event.f12168g = null;
            event.f12169h = null;
            event.f12170i = strArr;
            this.f12172b = false;
        }
    }

    private Event() {
    }

    public Event n(Map map) {
        Event a10 = new Builder(this.f12162a, this.f12165d, this.f12164c, this.f12170i).d(map).a();
        a10.f12163b = this.f12163b;
        a10.f12167f = this.f12167f;
        a10.f12168g = this.f12168g;
        return a10;
    }

    public Map o() {
        return this.f12166e;
    }

    public String[] p() {
        return this.f12170i;
    }

    public String q() {
        return this.f12162a;
    }

    public String r() {
        return this.f12169h;
    }

    public String s() {
        return this.f12168g;
    }

    public String t() {
        return this.f12164c;
    }

    public String toString() {
        StringBuilder sb2 = new StringBuilder();
        sb2.append("{");
        sb2.append("\n");
        sb2.append("    class: Event");
        sb2.append(",");
        sb2.append("\n");
        sb2.append("    name: ");
        sb2.append(this.f12162a);
        sb2.append(",");
        sb2.append("\n");
        sb2.append("    uniqueIdentifier: ");
        sb2.append(this.f12163b);
        sb2.append(",");
        sb2.append("\n");
        sb2.append("    source: ");
        sb2.append(this.f12164c);
        sb2.append(",");
        sb2.append("\n");
        sb2.append("    type: ");
        sb2.append(this.f12165d);
        sb2.append(",");
        sb2.append("\n");
        sb2.append("    responseId: ");
        sb2.append(this.f12168g);
        sb2.append(",");
        sb2.append("\n");
        sb2.append("    parentId: ");
        sb2.append(this.f12169h);
        sb2.append(",");
        sb2.append("\n");
        sb2.append("    timestamp: ");
        sb2.append(this.f12167f);
        sb2.append(",");
        sb2.append("\n");
        Map map = this.f12166e;
        String f10 = map == null ? "{}" : com.adobe.marketing.mobile.internal.util.e.f(map);
        sb2.append("    data: ");
        sb2.append(f10);
        sb2.append(",");
        sb2.append("\n");
        sb2.append("    mask: ");
        sb2.append(Arrays.toString(this.f12170i));
        sb2.append(",");
        sb2.append("\n");
        sb2.append("}");
        return sb2.toString();
    }

    public long u() {
        return this.f12167f;
    }

    public long v() {
        return TimeUnit.MILLISECONDS.toSeconds(this.f12167f);
    }

    public String w() {
        return this.f12165d;
    }

    public String x() {
        return this.f12163b;
    }
}
