package xyz.stream.api.database;

import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import vf.t;
import vf.w;
import xyz.stream.api.database.entity.RecordEntity;
import xyz.stream.utils.f0;

/* JADX INFO: loaded from: classes3.dex */
public final class q {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static volatile q f35842e;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public AppDatabase f35843a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public w f35844b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public t f35845c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final ExecutorService f35846d = Executors.newSingleThreadExecutor();

    public static q a() {
        if (f35842e == null) {
            synchronized (q.class) {
                try {
                    if (f35842e == null) {
                        f35842e = new q();
                    }
                } finally {
                }
            }
        }
        return f35842e;
    }

    public static void d(boolean z10, o oVar) {
        if (z10 && !xyz.stream.utils.e.h()) {
            if (oVar != null) {
                oVar.d(new ArrayList());
            }
        } else {
            q qVarA = a();
            com.google.gson.internal.a aVar = new com.google.gson.internal.a(oVar, 29);
            qVarA.getClass();
            qVarA.f35846d.submit(new ve.b(qVarA, aVar, 24));
        }
    }

    public final List b(Integer num) {
        String strQ = f0.o().q("flutter.selectRoles", "");
        w wVar = this.f35844b;
        int iIntValue = num.intValue();
        vf.i iVar = (vf.i) wVar;
        iVar.getClass();
        return (List) androidx.room.util.b.b(iVar.f33973a, true, false, new vf.b(iIntValue, 3, strQ));
    }

    public final RecordEntity c(Integer num) {
        String strQ = f0.o().q("flutter.selectRoles", "");
        w wVar = this.f35844b;
        int iIntValue = num.intValue();
        vf.i iVar = (vf.i) wVar;
        iVar.getClass();
        return (RecordEntity) androidx.room.util.b.b(iVar.f33973a, true, false, new vf.b(iIntValue, 5, strQ));
    }

    public final AppDatabase e(Context context) {
        AppDatabase appDatabase = this.f35843a;
        if (appDatabase != null) {
            return appDatabase;
        }
        AppDatabase appDatabaseCreateFromFile = AppDatabase.createFromFile(context);
        this.f35843a = appDatabaseCreateFromFile;
        this.f35844b = appDatabaseCreateFromFile.dao();
        this.f35845c = this.f35843a.myListDao();
        f.d().f35808a = this.f35843a;
        l lVarA = l.a();
        AppDatabase appDatabase2 = this.f35843a;
        lVarA.f35830c = appDatabase2;
        lVarA.f35829b = appDatabase2.liveDao();
        return this.f35843a;
    }

    public final void f(RecordEntity recordEntity) {
        this.f35846d.execute(new ve.b(this, recordEntity, 23));
    }
}
