package com.amplifyframework.notifications;

import android.content.Context;
import com.amplifyframework.analytics.UserProfile;
import com.amplifyframework.core.Action;
import com.amplifyframework.core.Consumer;
import com.amplifyframework.core.category.Category;
import com.amplifyframework.core.category.CategoryConfiguration;
import com.amplifyframework.core.category.CategoryType;
import com.amplifyframework.core.category.EmptyCategoryConfiguration;
import com.amplifyframework.core.category.SubCategoryType;
import com.amplifyframework.notifications.pushnotifications.PushNotificationsCategory;
import com.amplifyframework.notifications.pushnotifications.PushNotificationsException;
import com.amplifyframework.notifications.pushnotifications.PushNotificationsPlugin;
import com.google.android.gms.common.Scopes;
import java.util.Iterator;
import java.util.Set;
import kotlin.Metadata;
import kotlin.jvm.internal.t;

@Metadata(d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0016\u0018\u00002\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\u00020\u00012\u00020\u0003B\u0007¢\u0006\u0004\b\u001b\u0010\u001aJ\b\u0010\u0005\u001a\u00020\u0004H\u0016J\u0018\u0010\u000b\u001a\u00020\n2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\bH\u0016J&\u0010\u0013\u001a\u00020\n2\u0006\u0010\r\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u000e2\f\u0010\u0012\u001a\b\u0012\u0004\u0012\u00020\u00110\u0010H\u0016J.\u0010\u0013\u001a\u00020\n2\u0006\u0010\r\u001a\u00020\f2\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u000f\u001a\u00020\u000e2\f\u0010\u0012\u001a\b\u0012\u0004\u0012\u00020\u00110\u0010H\u0016R\u001c\u0010\u0017\u001a\u00020\u00168\u0006@\u0006X\u0087\u000e¢\u0006\f\n\u0004\b\u0017\u0010\u0018\u0012\u0004\b\u0019\u0010\u001a¨\u0006\u001c"}, d2 = {"Lcom/amplifyframework/notifications/NotificationsCategory;", "Lcom/amplifyframework/core/category/Category;", "Lcom/amplifyframework/notifications/NotificationsPlugin;", "Lcom/amplifyframework/notifications/NotificationsCategoryBehavior;", "Lcom/amplifyframework/core/category/CategoryType;", "getCategoryType", "Lcom/amplifyframework/core/category/CategoryConfiguration;", "configuration", "Landroid/content/Context;", "context", "Lrm/n0;", "configure", "", "userId", "Lcom/amplifyframework/core/Action;", "onSuccess", "Lcom/amplifyframework/core/Consumer;", "Lcom/amplifyframework/notifications/pushnotifications/PushNotificationsException;", "onError", "identifyUser", "Lcom/amplifyframework/analytics/UserProfile;", Scopes.PROFILE, "Lcom/amplifyframework/notifications/pushnotifications/PushNotificationsCategory;", "Push", "Lcom/amplifyframework/notifications/pushnotifications/PushNotificationsCategory;", "getPush$annotations", "()V", "<init>", "com.amplifyframework.core_release"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public class NotificationsCategory extends Category<NotificationsPlugin<?>> implements NotificationsCategoryBehavior {
    public PushNotificationsCategory Push = new PushNotificationsCategory();

    @Metadata(k = 3, mv = {1, 9, 0}, xi = 48)
    /* loaded from: classes4.dex */
    public /* synthetic */ class WhenMappings {
        public static final /* synthetic */ int[] $EnumSwitchMapping$0;

        static {
            int[] iArr = new int[SubCategoryType.values().length];
            try {
                iArr[SubCategoryType.PUSH_NOTIFICATIONS.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            $EnumSwitchMapping$0 = iArr;
        }
    }

    public static /* synthetic */ void getPush$annotations() {
    }

    @Override // com.amplifyframework.core.category.Category
    public void configure(CategoryConfiguration configuration, Context context) {
        t.g(configuration, "configuration");
        t.g(context, "context");
        Set<NotificationsPlugin<?>> plugins = getPlugins();
        t.f(plugins, "getPlugins(...)");
        Iterator<T> it = plugins.iterator();
        while (it.hasNext()) {
            NotificationsPlugin notificationsPlugin = (NotificationsPlugin) it.next();
            if (WhenMappings.$EnumSwitchMapping$0[notificationsPlugin.getSubCategoryType().ordinal()] == 1) {
                PushNotificationsCategory pushNotificationsCategory = this.Push;
                t.e(notificationsPlugin, "null cannot be cast to non-null type com.amplifyframework.notifications.pushnotifications.PushNotificationsPlugin<*>");
                pushNotificationsCategory.addPlugin((PushNotificationsPlugin) notificationsPlugin);
                CategoryConfiguration categoryConfiguration = configuration instanceof NotificationsCategoryConfiguration ? (NotificationsCategoryConfiguration) configuration : null;
                PushNotificationsCategory pushNotificationsCategory2 = this.Push;
                if (categoryConfiguration == null) {
                    categoryConfiguration = EmptyCategoryConfiguration.forCategoryType(getCategoryType());
                }
                pushNotificationsCategory2.configure(categoryConfiguration, context);
            }
        }
    }

    @Override // com.amplifyframework.core.category.CategoryTypeable
    public CategoryType getCategoryType() {
        return CategoryType.NOTIFICATIONS;
    }

    @Override // com.amplifyframework.notifications.NotificationsCategoryBehavior
    public void identifyUser(String userId, Action onSuccess, Consumer<PushNotificationsException> onError) {
        t.g(userId, "userId");
        t.g(onSuccess, "onSuccess");
        t.g(onError, "onError");
        this.Push.identifyUser(userId, onSuccess, onError);
    }

    @Override // com.amplifyframework.notifications.NotificationsCategoryBehavior
    public void identifyUser(String userId, UserProfile profile, Action onSuccess, Consumer<PushNotificationsException> onError) {
        t.g(userId, "userId");
        t.g(profile, "profile");
        t.g(onSuccess, "onSuccess");
        t.g(onError, "onError");
        this.Push.identifyUser(userId, profile, onSuccess, onError);
    }
}
