package m4;

import I2.C0317a;
import a.AbstractC0872a;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;

/* JADX INFO: loaded from: classes3.dex */
public final class W0 {

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final C0317a f20895g = new C0317a("io.grpc.internal.ManagedChannelServiceConfig.MethodInfo", 5);

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

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Integer f20899d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final R1 f20900e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final C2510h0 f20901f;

    public W0(Map map, boolean z6, int i6, int i7) {
        long j4;
        boolean z7;
        R1 r12;
        C2510h0 c2510h0;
        this.f20896a = AbstractC2557x0.i("timeout", map);
        this.f20897b = AbstractC2557x0.b("waitForReady", map);
        Integer numF = AbstractC2557x0.f("maxResponseMessageBytes", map);
        this.f20898c = numF;
        if (numF != null) {
            A4.g.j(numF, "maxInboundMessageSize %s exceeds bounds", numF.intValue() >= 0);
        }
        Integer numF2 = AbstractC2557x0.f("maxRequestMessageBytes", map);
        this.f20899d = numF2;
        if (numF2 != null) {
            A4.g.j(numF2, "maxOutboundMessageSize %s exceeds bounds", numF2.intValue() >= 0);
        }
        Map mapG = z6 ? AbstractC2557x0.g("retryPolicy", map) : null;
        if (mapG == null) {
            j4 = 0;
            r12 = null;
            z7 = true;
        } else {
            Integer numF3 = AbstractC2557x0.f("maxAttempts", mapG);
            A4.g.o(numF3, "maxAttempts cannot be empty");
            int iIntValue = numF3.intValue();
            A4.g.h(iIntValue, "maxAttempts must be greater than 1: %s", iIntValue >= 2);
            int iMin = Math.min(iIntValue, i6);
            Long lI = AbstractC2557x0.i("initialBackoff", mapG);
            A4.g.o(lI, "initialBackoff cannot be empty");
            long jLongValue = lI.longValue();
            A4.g.i(jLongValue, jLongValue > 0, "initialBackoffNanos must be greater than 0: %s");
            Long lI2 = AbstractC2557x0.i("maxBackoff", mapG);
            A4.g.o(lI2, "maxBackoff cannot be empty");
            long jLongValue2 = lI2.longValue();
            j4 = 0;
            z7 = true;
            A4.g.i(jLongValue2, jLongValue2 > 0, "maxBackoff must be greater than 0: %s");
            Double dE = AbstractC2557x0.e("backoffMultiplier", mapG);
            A4.g.o(dE, "backoffMultiplier cannot be empty");
            double dDoubleValue = dE.doubleValue();
            A4.g.j(dE, "backoffMultiplier must be greater than 0: %s", dDoubleValue > 0.0d);
            Long lI3 = AbstractC2557x0.i("perAttemptRecvTimeout", mapG);
            A4.g.j(lI3, "perAttemptRecvTimeout cannot be negative: %s", lI3 == null || lI3.longValue() >= 0);
            Set setP = c2.p("retryableStatusCodes", mapG);
            android.support.v4.media.session.b.P("retryableStatusCodes", "%s is required in retry policy", setP != null);
            android.support.v4.media.session.b.P("retryableStatusCodes", "%s must not contain OK", !setP.contains(k4.q0.OK));
            A4.g.l((lI3 == null && setP.isEmpty()) ? false : true, "retryableStatusCodes cannot be empty without perAttemptRecvTimeout");
            r12 = new R1(iMin, jLongValue, jLongValue2, dDoubleValue, lI3, setP);
        }
        this.f20900e = r12;
        Map mapG2 = z6 ? AbstractC2557x0.g("hedgingPolicy", map) : null;
        if (mapG2 == null) {
            c2510h0 = null;
        } else {
            Integer numF4 = AbstractC2557x0.f("maxAttempts", mapG2);
            A4.g.o(numF4, "maxAttempts cannot be empty");
            int iIntValue2 = numF4.intValue();
            A4.g.h(iIntValue2, "maxAttempts must be greater than 1: %s", iIntValue2 >= 2 ? z7 : false);
            int iMin2 = Math.min(iIntValue2, i7);
            Long lI4 = AbstractC2557x0.i("hedgingDelay", mapG2);
            A4.g.o(lI4, "hedgingDelay cannot be empty");
            long jLongValue3 = lI4.longValue();
            A4.g.i(jLongValue3, jLongValue3 >= j4 ? z7 : false, "hedgingDelay must not be negative: %s");
            Set setP2 = c2.p("nonFatalStatusCodes", mapG2);
            if (setP2 == null) {
                setP2 = Collections.unmodifiableSet(EnumSet.noneOf(k4.q0.class));
            } else {
                android.support.v4.media.session.b.P("nonFatalStatusCodes", "%s must not contain OK", !setP2.contains(k4.q0.OK));
            }
            c2510h0 = new C2510h0(iMin2, jLongValue3, setP2);
        }
        this.f20901f = c2510h0;
    }

    public final boolean equals(Object obj) {
        if (!(obj instanceof W0)) {
            return false;
        }
        W0 w02 = (W0) obj;
        return android.support.v4.media.session.b.n(this.f20896a, w02.f20896a) && android.support.v4.media.session.b.n(this.f20897b, w02.f20897b) && android.support.v4.media.session.b.n(this.f20898c, w02.f20898c) && android.support.v4.media.session.b.n(this.f20899d, w02.f20899d) && android.support.v4.media.session.b.n(this.f20900e, w02.f20900e) && android.support.v4.media.session.b.n(this.f20901f, w02.f20901f);
    }

    public final int hashCode() {
        return Arrays.hashCode(new Object[]{this.f20896a, this.f20897b, this.f20898c, this.f20899d, this.f20900e, this.f20901f});
    }

    public final String toString() {
        E3.j jVarI0 = AbstractC0872a.i0(this);
        jVarI0.a(this.f20896a, "timeoutNanos");
        jVarI0.a(this.f20897b, "waitForReady");
        jVarI0.a(this.f20898c, "maxInboundMessageSize");
        jVarI0.a(this.f20899d, "maxOutboundMessageSize");
        jVarI0.a(this.f20900e, "retryPolicy");
        jVarI0.a(this.f20901f, "hedgingPolicy");
        return jVarI0.toString();
    }
}
