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 Timestamp extends Message<Timestamp, Builder> {
    public static final ProtoAdapter<Timestamp> ADAPTER = new ProtoAdapter_Timestamp();
    public static final Integer DEFAULT_NANOS = 0;
    public static final Long DEFAULT_SECONDS = 0L;
    public static final long serialVersionUID = 0;
    @WireField(adapter = "com.squareup.wire.ProtoAdapter#INT32", tag = 2)
    public final Integer nanos;
    @WireField(adapter = "com.squareup.wire.ProtoAdapter#INT64", tag = 1)
    public final Long seconds;

    public static final class ProtoAdapter_Timestamp extends ProtoAdapter<Timestamp> {
        static {
            Covode.recordClassIndex(47589);
        }

        public ProtoAdapter_Timestamp() {
            super(FieldEncoding.LENGTH_DELIMITED, Timestamp.class);
        }

        public final Timestamp redact(Timestamp timestamp) {
            Builder newBuilder = timestamp.newBuilder();
            newBuilder.clearUnknownFields();
            return newBuilder.build();
        }

        public final int encodedSize(Timestamp timestamp) {
            return ProtoAdapter.INT64.encodedSizeWithTag(1, timestamp.seconds) + ProtoAdapter.INT32.encodedSizeWithTag(2, timestamp.nanos) + timestamp.unknownFields().size();
        }

        public final Timestamp 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.seconds(ProtoAdapter.INT64.decode(protoReader));
                } else if (nextTag != 2) {
                    FieldEncoding peekFieldEncoding = protoReader.peekFieldEncoding();
                    builder.addUnknownField(nextTag, peekFieldEncoding, peekFieldEncoding.rawProtoAdapter().decode(protoReader));
                } else {
                    builder.nanos(ProtoAdapter.INT32.decode(protoReader));
                }
            }
        }

        public final void encode(ProtoWriter protoWriter, Timestamp timestamp) {
            ProtoAdapter.INT64.encodeWithTag(protoWriter, 1, timestamp.seconds);
            ProtoAdapter.INT32.encodeWithTag(protoWriter, 2, timestamp.nanos);
            protoWriter.writeBytes(timestamp.unknownFields());
        }
    }

    public static final class Builder extends Message.Builder<Timestamp, Builder> {
        public Integer nanos;
        public Long seconds;

        static {
            Covode.recordClassIndex(47588);
        }

        public final Timestamp build() {
            return new Timestamp(this.seconds, this.nanos, buildUnknownFields());
        }

        public final Builder nanos(Integer num) {
            this.nanos = num;
            return this;
        }

        public final Builder seconds(Long l) {
            this.seconds = l;
            return this;
        }
    }

    static {
        Covode.recordClassIndex(47587);
    }

    public final Builder newBuilder() {
        Builder builder = new Builder();
        builder.seconds = this.seconds;
        builder.nanos = this.nanos;
        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;
        Long l = this.seconds;
        int i3 = 0;
        if (l != null) {
            i = l.hashCode();
        } else {
            i = 0;
        }
        int i4 = (hashCode + i) * 37;
        Integer num = this.nanos;
        if (num != null) {
            i3 = num.hashCode();
        }
        int i5 = i4 + i3;
        this.hashCode = i5;
        return i5;
    }

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

    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof Timestamp)) {
            return false;
        }
        Timestamp timestamp = (Timestamp) obj;
        if (!unknownFields().equals(timestamp.unknownFields()) || !PBO.LIZ((Object) this.seconds, (Object) timestamp.seconds) || !PBO.LIZ((Object) this.nanos, (Object) timestamp.nanos)) {
            return false;
        }
        return true;
    }

    public Timestamp(Long l, Integer num) {
        this(l, num, Q1J.EMPTY);
    }

    public Timestamp(Long l, Integer num, Q1J q1j) {
        super(ADAPTER, q1j);
        this.seconds = l;
        this.nanos = num;
    }
}
