package com.snapchat.kit.sdk.core.metrics.model;

import X.PBO;
import X.Q1J;
import com.bytedance.covode.number.Covode;
import com.squareup.wire.FieldEncoding;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoAdapter;
import com.squareup.wire.ProtoReader;
import com.squareup.wire.ProtoWriter;
import com.squareup.wire.WireField;

public final class KitHeartbeat extends Message<KitHeartbeat, Builder> {
    public static final ProtoAdapter<KitHeartbeat> ADAPTER = new ProtoAdapter_KitHeartbeat();
    public static final long serialVersionUID = 0;
    @WireField(adapter = "com.squareup.wire.ProtoAdapter#STRING", tag = 2)
    public final String installation_id;
    @WireField(adapter = "com.snapchat.kit.sdk.core.metrics.model.KitEventBase#ADAPTER", tag = 1)
    public final KitEventBase kit_event_base;

    public static final class ProtoAdapter_KitHeartbeat extends ProtoAdapter<KitHeartbeat> {
        static {
            Covode.recordClassIndex(47528);
        }

        public ProtoAdapter_KitHeartbeat() {
            super(FieldEncoding.LENGTH_DELIMITED, KitHeartbeat.class);
        }

        public final int encodedSize(KitHeartbeat kitHeartbeat) {
            return KitEventBase.ADAPTER.encodedSizeWithTag(1, kitHeartbeat.kit_event_base) + ProtoAdapter.STRING.encodedSizeWithTag(2, kitHeartbeat.installation_id) + kitHeartbeat.unknownFields().size();
        }

        public final KitHeartbeat redact(KitHeartbeat kitHeartbeat) {
            Builder newBuilder = kitHeartbeat.newBuilder();
            if (newBuilder.kit_event_base != null) {
                newBuilder.kit_event_base = (KitEventBase) KitEventBase.ADAPTER.redact(newBuilder.kit_event_base);
            }
            newBuilder.clearUnknownFields();
            return newBuilder.build();
        }

        public final KitHeartbeat decode(ProtoReader protoReader) {
            Builder builder = new Builder();
            long beginMessage = protoReader.beginMessage();
            while (true) {
                int nextTag = protoReader.nextTag();
                if (nextTag == -1) {
                    protoReader.endMessage(beginMessage);
                    return builder.build();
                } else if (nextTag == 1) {
                    builder.kit_event_base((KitEventBase) KitEventBase.ADAPTER.decode(protoReader));
                } else if (nextTag != 2) {
                    FieldEncoding peekFieldEncoding = protoReader.peekFieldEncoding();
                    builder.addUnknownField(nextTag, peekFieldEncoding, peekFieldEncoding.rawProtoAdapter().decode(protoReader));
                } else {
                    builder.installation_id((String) ProtoAdapter.STRING.decode(protoReader));
                }
            }
        }

        public final void encode(ProtoWriter protoWriter, KitHeartbeat kitHeartbeat) {
            KitEventBase.ADAPTER.encodeWithTag(protoWriter, 1, kitHeartbeat.kit_event_base);
            ProtoAdapter.STRING.encodeWithTag(protoWriter, 2, kitHeartbeat.installation_id);
            protoWriter.writeBytes(kitHeartbeat.unknownFields());
        }
    }

    public static final class Builder extends Message.Builder<KitHeartbeat, Builder> {
        public String installation_id;
        public KitEventBase kit_event_base;

        static {
            Covode.recordClassIndex(47527);
        }

        public final KitHeartbeat build() {
            return new KitHeartbeat(this.kit_event_base, this.installation_id, buildUnknownFields());
        }

        public final Builder installation_id(String str) {
            this.installation_id = str;
            return this;
        }

        public final Builder kit_event_base(KitEventBase kitEventBase) {
            this.kit_event_base = kitEventBase;
            return this;
        }
    }

    static {
        Covode.recordClassIndex(47526);
    }

    public final Builder newBuilder() {
        Builder builder = new Builder();
        builder.kit_event_base = this.kit_event_base;
        builder.installation_id = this.installation_id;
        builder.addUnknownFields(unknownFields());
        return builder;
    }

    public final int hashCode() {
        int i;
        int i2 = this.hashCode;
        if (i2 != 0) {
            return i2;
        }
        int hashCode = unknownFields().hashCode() * 37;
        KitEventBase kitEventBase = this.kit_event_base;
        int i3 = 0;
        if (kitEventBase != null) {
            i = kitEventBase.hashCode();
        } else {
            i = 0;
        }
        int i4 = (hashCode + i) * 37;
        String str = this.installation_id;
        if (str != null) {
            i3 = str.hashCode();
        }
        int i5 = i4 + i3;
        this.hashCode = i5;
        return i5;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder();
        if (this.kit_event_base != null) {
            sb.append(", kit_event_base=");
            sb.append(this.kit_event_base);
        }
        if (this.installation_id != null) {
            sb.append(", installation_id=");
            sb.append(this.installation_id);
        }
        sb.replace(0, 2, "KitHeartbeat{");
        sb.append('}');
        return sb.toString();
    }

    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof KitHeartbeat)) {
            return false;
        }
        KitHeartbeat kitHeartbeat = (KitHeartbeat) obj;
        if (!unknownFields().equals(kitHeartbeat.unknownFields()) || !PBO.LIZ(this.kit_event_base, kitHeartbeat.kit_event_base) || !PBO.LIZ(this.installation_id, kitHeartbeat.installation_id)) {
            return false;
        }
        return true;
    }

    public KitHeartbeat(KitEventBase kitEventBase, String str) {
        this(kitEventBase, str, Q1J.EMPTY);
    }

    public KitHeartbeat(KitEventBase kitEventBase, String str, Q1J q1j) {
        super(ADAPTER, q1j);
        this.kit_event_base = kitEventBase;
        this.installation_id = str;
    }
}
