package com.snap.kit.sdk.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 MetricSampleRate extends Message<MetricSampleRate, Builder> {
    public static final ProtoAdapter<MetricSampleRate> ADAPTER = new ProtoAdapter_MetricSampleRate();
    public static final Double DEFAULT_RATE = Double.valueOf(0.0d);
    public static final long serialVersionUID = 0;
    @WireField(adapter = "com.squareup.wire.ProtoAdapter#DOUBLE", tag = 1)
    public final Double rate;

    public static final class ProtoAdapter_MetricSampleRate extends ProtoAdapter<MetricSampleRate> {
        static {
            Covode.recordClassIndex(47356);
        }

        public ProtoAdapter_MetricSampleRate() {
            super(FieldEncoding.LENGTH_DELIMITED, MetricSampleRate.class);
        }

        public final MetricSampleRate redact(MetricSampleRate metricSampleRate) {
            Builder newBuilder = metricSampleRate.newBuilder();
            newBuilder.clearUnknownFields();
            return newBuilder.build();
        }

        public final int encodedSize(MetricSampleRate metricSampleRate) {
            return ProtoAdapter.DOUBLE.encodedSizeWithTag(1, metricSampleRate.rate) + metricSampleRate.unknownFields().size();
        }

        public final MetricSampleRate 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) {
                    FieldEncoding peekFieldEncoding = protoReader.peekFieldEncoding();
                    builder.addUnknownField(nextTag, peekFieldEncoding, peekFieldEncoding.rawProtoAdapter().decode(protoReader));
                } else {
                    builder.rate(ProtoAdapter.DOUBLE.decode(protoReader));
                }
            }
        }

        public final void encode(ProtoWriter protoWriter, MetricSampleRate metricSampleRate) {
            ProtoAdapter.DOUBLE.encodeWithTag(protoWriter, 1, metricSampleRate.rate);
            protoWriter.writeBytes(metricSampleRate.unknownFields());
        }
    }

    public static final class Builder extends Message.Builder<MetricSampleRate, Builder> {
        public Double rate;

        static {
            Covode.recordClassIndex(47355);
        }

        public final MetricSampleRate build() {
            return new MetricSampleRate(this.rate, buildUnknownFields());
        }

        public final Builder rate(Double d) {
            this.rate = d;
            return this;
        }
    }

    static {
        Covode.recordClassIndex(47354);
    }

    public final int hashCode() {
        int i;
        int i2 = this.hashCode;
        if (i2 != 0) {
            return i2;
        }
        int hashCode = unknownFields().hashCode() * 37;
        Double d = this.rate;
        if (d != null) {
            i = d.hashCode();
        } else {
            i = 0;
        }
        int i3 = hashCode + i;
        this.hashCode = i3;
        return i3;
    }

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

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

    public MetricSampleRate(Double d) {
        this(d, Q1J.EMPTY);
    }

    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof MetricSampleRate)) {
            return false;
        }
        MetricSampleRate metricSampleRate = (MetricSampleRate) obj;
        if (!unknownFields().equals(metricSampleRate.unknownFields()) || !PBO.LIZ((Object) this.rate, (Object) metricSampleRate.rate)) {
            return false;
        }
        return true;
    }

    public MetricSampleRate(Double d, Q1J q1j) {
        super(ADAPTER, q1j);
        this.rate = d;
    }
}
