package g7;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import n7.l2;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public class a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final int f26270a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final String f26271b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final String f26272c;

    @Nullable
    private final a zzd;

    public a(int i10, @NonNull String str, @NonNull String str2, @Nullable a aVar) {
        this.f26270a = i10;
        this.f26271b = str;
        this.f26272c = str2;
        this.zzd = aVar;
    }

    public final l2 a() {
        l2 l2Var;
        a aVar = this.zzd;
        if (aVar == null) {
            l2Var = null;
        } else {
            String str = aVar.f26272c;
            l2Var = new l2(aVar.f26270a, aVar.f26271b, str, null, null);
        }
        return new l2(this.f26270a, this.f26271b, this.f26272c, l2Var, null);
    }

    public JSONObject b() throws JSONException {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("Code", this.f26270a);
        jSONObject.put("Message", this.f26271b);
        jSONObject.put("Domain", this.f26272c);
        a aVar = this.zzd;
        if (aVar == null) {
            jSONObject.put("Cause", "null");
        } else {
            jSONObject.put("Cause", aVar.b());
        }
        return jSONObject;
    }

    @Nullable
    public a getCause() {
        return this.zzd;
    }

    public String toString() {
        try {
            return b().toString(2);
        } catch (JSONException unused) {
            return "Error forming toString output.";
        }
    }
}
