package com.revenuecat.purchases.paywalls;

import android.graphics.Color;
import android.os.Build;
import com.revenuecat.purchases.InternalRevenueCatAPI;
import g5.a;
import i5.e;
import i5.g;
import j5.c;
import j5.d;
import java.util.Arrays;
import java.util.Locale;
import kotlin.jvm.internal.o;

/* JADX INFO: loaded from: classes3.dex */
@InternalRevenueCatAPI
public final class PaywallColor {
    private final int colorInt;
    private final String stringRepresentation;
    private final Color underlyingColor;

    public static final class Serializer implements a {
        public static final Serializer INSTANCE = new Serializer();
        private static final g descriptor = W.a.L("PaywallColor", e.f19086r);

        private Serializer() {
        }

        @Override // g5.a
        public g getDescriptor() {
            return descriptor;
        }

        @Override // g5.a
        public PaywallColor deserialize(c decoder) {
            o.h(decoder, "decoder");
            return new PaywallColor(decoder.q());
        }

        @Override // g5.a
        public void serialize(d encoder, PaywallColor value) {
            o.h(encoder, "encoder");
            o.h(value, "value");
            encoder.F(value.toString());
        }
    }

    public PaywallColor(String stringRepresentation, Color color) {
        o.h(stringRepresentation, "stringRepresentation");
        this.stringRepresentation = stringRepresentation;
        this.underlyingColor = color;
        this.colorInt = ColorUtilsKt.parseRGBAColor(stringRepresentation);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof PaywallColor)) {
            return false;
        }
        PaywallColor paywallColor = (PaywallColor) obj;
        return o.c(this.stringRepresentation, paywallColor.stringRepresentation) && o.c(this.underlyingColor, paywallColor.underlyingColor);
    }

    public final int getColorInt() {
        return this.colorInt;
    }

    public final String getStringRepresentation() {
        return this.stringRepresentation;
    }

    public final Color getUnderlyingColor() {
        return this.underlyingColor;
    }

    public int hashCode() {
        int iHashCode = this.stringRepresentation.hashCode() * 31;
        Color color = this.underlyingColor;
        return iHashCode + (color == null ? 0 : color.hashCode());
    }

    public String toString() {
        return "PaywallColor(stringRepresentation=" + this.stringRepresentation + ", underlyingColor=" + this.underlyingColor + ')';
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public PaywallColor(String stringRepresentation) {
        this(stringRepresentation, Build.VERSION.SDK_INT >= 26 ? Color.valueOf(ColorUtilsKt.parseRGBAColor(stringRepresentation)) : null);
        o.h(stringRepresentation, "stringRepresentation");
    }

    public PaywallColor(int i6) {
        this(String.format(Locale.US, "#%06X", Arrays.copyOf(new Object[]{Integer.valueOf(16777215 & i6)}, 1)), Build.VERSION.SDK_INT >= 26 ? Color.valueOf(i6) : null);
    }
}
