package la;

import ca.canadapost.core.data.auth.model.AMSErrorResponseException;
import ca.canadapost.core.data.model.CommonErrorResponseException;
import ca.canadapost.core.data.model.CoreConstants;
import ca.canadapost.core.data.model.ResultWrapper;
import ca.canadapost.core.data.profile.api.AccountQRCodeApi;
import ca.canadapost.core.data.profile.api.IAMSApi;
import ca.canadapost.core.data.profile.api.IDupEmailApi;
import ca.canadapost.core.data.profile.api.IOAuthApi;
import ca.canadapost.core.data.profile.api.IProfileApi;
import dn.l;
import g9.s;
import g9.w;
import ha.g;
import java.util.concurrent.TimeUnit;
import km.t;
import kotlin.jvm.internal.p0;
import kotlin.jvm.internal.v;
import or.u;
import uq.z;

/* loaded from: classes.dex */
public final class a {

    /* renamed from: la.a$a, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    static final class C0623a extends v implements l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ t f27819p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        C0623a(t tVar) {
            super(1);
            this.f27819p = tVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final ResultWrapper.Error invoke(or.t response) {
            kotlin.jvm.internal.t.g(response, "response");
            return g.a(response, this.f27819p, p0.b(CommonErrorResponseException.class));
        }
    }

    /* loaded from: classes.dex */
    static final class b extends v implements l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ t f27820p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        b(t tVar) {
            super(1);
            this.f27820p = tVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final ResultWrapper.Error invoke(or.t response) {
            kotlin.jvm.internal.t.g(response, "response");
            return g.a(response, this.f27820p, p0.b(AMSErrorResponseException.class));
        }
    }

    /* loaded from: classes.dex */
    static final class c extends v implements l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ t f27821p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(t tVar) {
            super(1);
            this.f27821p = tVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final ResultWrapper.Error invoke(or.t response) {
            kotlin.jvm.internal.t.g(response, "response");
            return g.a(response, this.f27821p, p0.b(CommonErrorResponseException.class));
        }
    }

    /* loaded from: classes.dex */
    static final class d extends v implements l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ t f27822p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        d(t tVar) {
            super(1);
            this.f27822p = tVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final ResultWrapper.Error invoke(or.t response) {
            kotlin.jvm.internal.t.g(response, "response");
            return g.a(response, this.f27822p, p0.b(ta.a.class));
        }
    }

    /* loaded from: classes.dex */
    static final class e extends v implements l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ t f27823p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        e(t tVar) {
            super(1);
            this.f27823p = tVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final ResultWrapper.Error invoke(or.t response) {
            kotlin.jvm.internal.t.g(response, "response");
            return g.a(response, this.f27823p, p0.b(CommonErrorResponseException.class));
        }
    }

    public final IDupEmailApi a(ha.c httpClientBuilderFactory, w tokenInjectInterceptor, s authenticator, jr.a loggingInterceptor, f9.a fireBaseAppCheckInterceptor, t moshi) {
        kotlin.jvm.internal.t.g(httpClientBuilderFactory, "httpClientBuilderFactory");
        kotlin.jvm.internal.t.g(tokenInjectInterceptor, "tokenInjectInterceptor");
        kotlin.jvm.internal.t.g(authenticator, "authenticator");
        kotlin.jvm.internal.t.g(loggingInterceptor, "loggingInterceptor");
        kotlin.jvm.internal.t.g(fireBaseAppCheckInterceptor, "fireBaseAppCheckInterceptor");
        kotlin.jvm.internal.t.g(moshi, "moshi");
        Object b10 = new u.b().c("https://www.canadapost-postescanada.ca/mgw/").b(qr.a.g(moshi)).g(httpClientBuilderFactory.a().a(fireBaseAppCheckInterceptor).a(tokenInjectInterceptor).c(authenticator).a(loggingInterceptor).d()).a(new ha.f(new C0623a(moshi))).e().b(IDupEmailApi.class);
        kotlin.jvm.internal.t.f(b10, "create(...)");
        return (IDupEmailApi) b10;
    }

    public final IAMSApi b(ha.c httpClientBuilderFactory, w tokenInjectInterceptor, s authenticator, jr.a loggingInterceptor, f9.a fireBaseAppCheckInterceptor, t moshi) {
        kotlin.jvm.internal.t.g(httpClientBuilderFactory, "httpClientBuilderFactory");
        kotlin.jvm.internal.t.g(tokenInjectInterceptor, "tokenInjectInterceptor");
        kotlin.jvm.internal.t.g(authenticator, "authenticator");
        kotlin.jvm.internal.t.g(loggingInterceptor, "loggingInterceptor");
        kotlin.jvm.internal.t.g(fireBaseAppCheckInterceptor, "fireBaseAppCheckInterceptor");
        kotlin.jvm.internal.t.g(moshi, "moshi");
        Object b10 = new u.b().c("https://www.canadapost-postescanada.ca/mgw/").b(qr.a.g(moshi)).g(httpClientBuilderFactory.a().a(fireBaseAppCheckInterceptor).a(tokenInjectInterceptor).c(authenticator).a(loggingInterceptor).d()).a(new ha.f(new b(moshi))).e().b(IAMSApi.class);
        kotlin.jvm.internal.t.f(b10, "create(...)");
        return (IAMSApi) b10;
    }

    public final AccountQRCodeApi c(ha.c httpClientBuilderFactory, w tokenInjectInterceptor, s authenticator, jr.a loggingInterceptor, f9.a fireBaseAppCheckInterceptor, t moshi) {
        kotlin.jvm.internal.t.g(httpClientBuilderFactory, "httpClientBuilderFactory");
        kotlin.jvm.internal.t.g(tokenInjectInterceptor, "tokenInjectInterceptor");
        kotlin.jvm.internal.t.g(authenticator, "authenticator");
        kotlin.jvm.internal.t.g(loggingInterceptor, "loggingInterceptor");
        kotlin.jvm.internal.t.g(fireBaseAppCheckInterceptor, "fireBaseAppCheckInterceptor");
        kotlin.jvm.internal.t.g(moshi, "moshi");
        Object b10 = new u.b().c("https://www.canadapost-postescanada.ca/mgw/").b(qr.a.g(moshi)).g(httpClientBuilderFactory.a().a(fireBaseAppCheckInterceptor).a(tokenInjectInterceptor).c(authenticator).a(loggingInterceptor).d()).a(new ha.f(new c(moshi))).e().b(AccountQRCodeApi.class);
        kotlin.jvm.internal.t.f(b10, "create(...)");
        return (AccountQRCodeApi) b10;
    }

    public final IOAuthApi d(ha.c httpClientBuilderFactory, jr.a loggingInterceptor, t moshi) {
        kotlin.jvm.internal.t.g(httpClientBuilderFactory, "httpClientBuilderFactory");
        kotlin.jvm.internal.t.g(loggingInterceptor, "loggingInterceptor");
        kotlin.jvm.internal.t.g(moshi, "moshi");
        u.b b10 = new u.b().c(CoreConstants.OAUTH_ROOT).b(qr.a.g(moshi));
        z.a a10 = httpClientBuilderFactory.a();
        TimeUnit timeUnit = TimeUnit.SECONDS;
        Object b11 = b10.g(a10.e(60L, timeUnit).N(60L, timeUnit).P(60L, timeUnit).a(loggingInterceptor).d()).a(new ha.f(new d(moshi))).e().b(IOAuthApi.class);
        kotlin.jvm.internal.t.f(b11, "create(...)");
        return (IOAuthApi) b11;
    }

    public final IProfileApi e(ha.c httpClientBuilderFactory, w tokenInjectInterceptor, f9.a fireBaseAppCheckInterceptor, s authenticator, jr.a loggingInterceptor, t moshi) {
        kotlin.jvm.internal.t.g(httpClientBuilderFactory, "httpClientBuilderFactory");
        kotlin.jvm.internal.t.g(tokenInjectInterceptor, "tokenInjectInterceptor");
        kotlin.jvm.internal.t.g(fireBaseAppCheckInterceptor, "fireBaseAppCheckInterceptor");
        kotlin.jvm.internal.t.g(authenticator, "authenticator");
        kotlin.jvm.internal.t.g(loggingInterceptor, "loggingInterceptor");
        kotlin.jvm.internal.t.g(moshi, "moshi");
        u.b b10 = new u.b().c("https://www.canadapost-postescanada.ca/mgw/").b(qr.a.g(moshi));
        z.a a10 = httpClientBuilderFactory.a();
        TimeUnit timeUnit = TimeUnit.SECONDS;
        Object b11 = b10.g(a10.e(60L, timeUnit).N(60L, timeUnit).P(60L, timeUnit).a(fireBaseAppCheckInterceptor).a(tokenInjectInterceptor).c(authenticator).a(loggingInterceptor).d()).a(new ha.f(new e(moshi))).e().b(IProfileApi.class);
        kotlin.jvm.internal.t.f(b11, "create(...)");
        return (IProfileApi) b11;
    }
}
