package h.b.p.a0;

import h.b.m.j;
import h.b.m.k;
import java.util.List;

/* JADX INFO: compiled from: PolymorphismValidator.kt */
/* JADX INFO: loaded from: classes.dex */
@g.i
public final class z implements h.b.q.e {
    public final boolean a;

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

    public z(boolean z, String str) {
        g.h0.c.l.f(str, "discriminator");
        this.a = z;
        this.f4546b = str;
    }

    public <T> void a(g.k0.c<T> cVar, g.h0.b.l<? super List<? extends h.b.b<?>>, ? extends h.b.b<?>> lVar) {
        g.h0.c.l.f(cVar, "kClass");
        g.h0.c.l.f(lVar, "provider");
    }

    public <T> void b(g.k0.c<T> cVar, h.b.b<T> bVar) {
        g.h0.c.l.f(cVar, "kClass");
        g.h0.c.l.f(bVar, "serializer");
        a(cVar, new h.b.q.d(bVar));
    }

    public <Base, Sub extends Base> void c(g.k0.c<Base> cVar, g.k0.c<Sub> cVar2, h.b.b<Sub> bVar) {
        g.h0.c.l.f(cVar, "baseClass");
        g.h0.c.l.f(cVar2, "actualClass");
        g.h0.c.l.f(bVar, "actualSerializer");
        h.b.m.e eVarA = bVar.a();
        h.b.m.j jVarE = eVarA.e();
        if ((jVarE instanceof h.b.m.c) || g.h0.c.l.a(jVarE, j.a.a)) {
            StringBuilder sbB = d.b.a.a.a.B("Serializer for ");
            sbB.append(cVar2.a());
            sbB.append(" can't be registered as a subclass for polymorphic serialization because its kind ");
            sbB.append(jVarE);
            sbB.append(" is not concrete. To work with multiple hierarchies, register it as a base class.");
            throw new IllegalArgumentException(sbB.toString());
        }
        if (!this.a && (g.h0.c.l.a(jVarE, k.b.a) || g.h0.c.l.a(jVarE, k.c.a) || (jVarE instanceof h.b.m.d) || (jVarE instanceof j.b))) {
            StringBuilder sbB2 = d.b.a.a.a.B("Serializer for ");
            sbB2.append(cVar2.a());
            sbB2.append(" of kind ");
            sbB2.append(jVarE);
            sbB2.append(" cannot be serialized polymorphically with class discriminator.");
            throw new IllegalArgumentException(sbB2.toString());
        }
        if (this.a) {
            return;
        }
        int iF = eVarA.f();
        for (int i2 = 0; i2 < iF; i2++) {
            String strG = eVarA.g(i2);
            if (g.h0.c.l.a(strG, this.f4546b)) {
                throw new IllegalArgumentException("Polymorphic serializer for " + cVar2 + " has property '" + strG + "' that conflicts with JSON class discriminator. You can either change class discriminator in JsonConfiguration, rename property with @SerialName annotation or fall back to array polymorphism");
            }
        }
    }

    public <Base> void d(g.k0.c<Base> cVar, g.h0.b.l<? super String, ? extends h.b.a<? extends Base>> lVar) {
        g.h0.c.l.f(cVar, "baseClass");
        g.h0.c.l.f(lVar, "defaultDeserializerProvider");
    }

    public <Base> void e(g.k0.c<Base> cVar, g.h0.b.l<? super Base, ? extends h.b.j<? super Base>> lVar) {
        g.h0.c.l.f(cVar, "baseClass");
        g.h0.c.l.f(lVar, "defaultSerializerProvider");
    }
}
