package com.google.android.gms.fido.u2f.api.common;

import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.fido.u2f.api.common.ChannelIdValue;
import defpackage.vo6;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
@Deprecated
public class ClientData {

    @vo6
    public static final String KEY_CHALLENGE = "challenge";

    @vo6
    public static final String KEY_CID_PUBKEY = "cid_pubkey";

    @vo6
    public static final String KEY_ORIGIN = "origin";

    @vo6
    public static final String KEY_TYPE = "typ";

    @vo6
    public static final String TYPE_FINISH_ENROLLMENT = "navigator.id.finishEnrollment";

    @vo6
    public static final String TYPE_GET_ASSERTION = "navigator.id.getAssertion";
    private final String zza;
    private final String zzb;
    private final String zzc;
    private final ChannelIdValue zzd;

    public static class Builder implements Cloneable {
        private String zza;
        private String zzb;
        private String zzc;
        private ChannelIdValue zzd;

        public Builder(String str, String str2, String str3, ChannelIdValue channelIdValue) {
            this.zza = str;
            this.zzb = str2;
            this.zzc = str3;
            this.zzd = channelIdValue;
        }

        @vo6
        public static Builder newInstance() {
            return new Builder();
        }

        @vo6
        public ClientData build() {
            return new ClientData(this.zza, this.zzb, this.zzc, this.zzd);
        }

        @vo6
        /* JADX INFO: renamed from: clone, reason: merged with bridge method [inline-methods] */
        public Builder m50clone() {
            return new Builder(this.zza, this.zzb, this.zzc, this.zzd);
        }

        @vo6
        public Builder setChallenge(@vo6 String str) {
            this.zzb = str;
            return this;
        }

        @vo6
        public Builder setChannelId(@vo6 ChannelIdValue channelIdValue) {
            this.zzd = channelIdValue;
            return this;
        }

        @vo6
        public Builder setOrigin(@vo6 String str) {
            this.zzc = str;
            return this;
        }

        @vo6
        public Builder setType(@vo6 String str) {
            this.zza = str;
            return this;
        }

        public Builder() {
            this.zzd = ChannelIdValue.ABSENT;
        }
    }

    public ClientData(String str, String str2, String str3, ChannelIdValue channelIdValue) {
        this.zza = (String) Preconditions.checkNotNull(str);
        this.zzb = (String) Preconditions.checkNotNull(str2);
        this.zzc = (String) Preconditions.checkNotNull(str3);
        this.zzd = (ChannelIdValue) Preconditions.checkNotNull(channelIdValue);
    }

    public boolean equals(@vo6 Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof ClientData)) {
            return false;
        }
        ClientData clientData = (ClientData) obj;
        return this.zza.equals(clientData.zza) && this.zzb.equals(clientData.zzb) && this.zzc.equals(clientData.zzc) && this.zzd.equals(clientData.zzd);
    }

    public int hashCode() {
        int iHashCode = this.zza.hashCode() + 31;
        int iHashCode2 = this.zzb.hashCode() + (iHashCode * 31);
        int iHashCode3 = this.zzc.hashCode() + (iHashCode2 * 31);
        return this.zzd.hashCode() + (iHashCode3 * 31);
    }

    @vo6
    public String toJsonString() {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put(KEY_TYPE, this.zza);
            jSONObject.put(KEY_CHALLENGE, this.zzb);
            jSONObject.put("origin", this.zzc);
            ChannelIdValue.ChannelIdValueType channelIdValueType = ChannelIdValue.ChannelIdValueType.ABSENT;
            int iOrdinal = this.zzd.getType().ordinal();
            if (iOrdinal == 1) {
                jSONObject.put(KEY_CID_PUBKEY, this.zzd.getStringValue());
            } else if (iOrdinal == 2) {
                jSONObject.put(KEY_CID_PUBKEY, this.zzd.getObjectValue());
            }
            return jSONObject.toString();
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
    }
}
