package com.revenuecat.purchases.google;

import I2.C0332p;
import I2.C0335t;
import I2.C0336u;
import I2.r;
import com.revenuecat.purchases.models.GoogleInstallmentsInfo;
import com.revenuecat.purchases.models.GoogleSubscriptionOption;
import java.util.ArrayList;
import kotlin.jvm.internal.o;
import x4.AbstractC3251q;
import x4.AbstractC3253s;

/* JADX INFO: loaded from: classes3.dex */
public final class SubscriptionOptionConversionsKt {
    private static final GoogleInstallmentsInfo getInstallmentsInfo(C0332p c0332p) {
        return new GoogleInstallmentsInfo(c0332p.f2642a, c0332p.f2643b);
    }

    public static final String getSubscriptionBillingPeriod(C0335t c0335t) {
        o.h(c0335t, "<this>");
        ArrayList arrayList = c0335t.f2662d.f2658b;
        o.g(arrayList, "this.pricingPhases.pricingPhaseList");
        r rVar = (r) AbstractC3251q.o0(arrayList);
        if (rVar != null) {
            return rVar.f2654d;
        }
        return null;
    }

    public static final boolean isBasePlan(C0335t c0335t) {
        o.h(c0335t, "<this>");
        return c0335t.f2662d.f2658b.size() == 1;
    }

    public static final GoogleSubscriptionOption toSubscriptionOption(C0335t c0335t, String productId, C0336u productDetails) {
        o.h(c0335t, "<this>");
        o.h(productId, "productId");
        o.h(productDetails, "productDetails");
        ArrayList<r> arrayList = c0335t.f2662d.f2658b;
        o.g(arrayList, "pricingPhases.pricingPhaseList");
        ArrayList arrayList2 = new ArrayList(AbstractC3253s.G(arrayList, 10));
        for (r it : arrayList) {
            o.g(it, "it");
            arrayList2.add(PricingPhaseConversionsKt.toRevenueCatPricingPhase(it));
        }
        String basePlanId = c0335t.f2659a;
        o.g(basePlanId, "basePlanId");
        ArrayList offerTags = c0335t.f2663e;
        o.g(offerTags, "offerTags");
        String offerToken = c0335t.f2661c;
        o.g(offerToken, "offerToken");
        C0332p c0332p = c0335t.f2664f;
        return new GoogleSubscriptionOption(productId, basePlanId, c0335t.f2660b, arrayList2, offerTags, productDetails, offerToken, null, c0332p != null ? getInstallmentsInfo(c0332p) : null);
    }
}
