package com.strmr.ps.data.local.dao;

import android.database.Cursor;
import androidx.room.RoomDatabase;
import com.google.android.gms.common.Scopes;
import com.strmr.ps.data.local.entity.AllDebridAccount;
import defpackage.e6a;
import defpackage.mk1;
import defpackage.oq8;
import defpackage.p58;
import defpackage.pe9;
import defpackage.rq6;
import defpackage.sp1;
import defpackage.vo6;
import defpackage.vw2;
import defpackage.xm2;
import defpackage.yn1;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import kotlin.coroutines.Continuation;

/* JADX INFO: loaded from: classes3.dex */
public final class AllDebridAccountDao_Impl implements AllDebridAccountDao {
    private final RoomDatabase __db;
    private final xm2<AllDebridAccount> __insertionAdapterOfAllDebridAccount;
    private final oq8 __preparedStmtOfDeleteAccount;

    public AllDebridAccountDao_Impl(@vo6 RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
        this.__insertionAdapterOfAllDebridAccount = new xm2<AllDebridAccount>(roomDatabase) { // from class: com.strmr.ps.data.local.dao.AllDebridAccountDao_Impl.1
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "INSERT OR REPLACE INTO `alldebrid_accounts` (`providerId`,`apiKey`,`username`,`email`,`isPremium`,`isSubscribed`,`isTrial`,`premiumUntil`,`fidelityPoints`,`lastVerifiedAt`,`createdAt`) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
            }

            @Override // defpackage.xm2
            public void bind(@vo6 pe9 pe9Var, @vo6 AllDebridAccount allDebridAccount) {
                pe9Var.bindString(1, allDebridAccount.getProviderId());
                pe9Var.bindString(2, allDebridAccount.getApiKey());
                if (allDebridAccount.getUsername() == null) {
                    pe9Var.bindNull(3);
                } else {
                    pe9Var.bindString(3, allDebridAccount.getUsername());
                }
                if (allDebridAccount.getEmail() == null) {
                    pe9Var.bindNull(4);
                } else {
                    pe9Var.bindString(4, allDebridAccount.getEmail());
                }
                pe9Var.bindLong(5, allDebridAccount.isPremium() ? 1L : 0L);
                if ((allDebridAccount.isSubscribed() == null ? null : Integer.valueOf(allDebridAccount.isSubscribed().booleanValue() ? 1 : 0)) == null) {
                    pe9Var.bindNull(6);
                } else {
                    pe9Var.bindLong(6, r0.intValue());
                }
                if ((allDebridAccount.isTrial() != null ? Integer.valueOf(allDebridAccount.isTrial().booleanValue() ? 1 : 0) : null) == null) {
                    pe9Var.bindNull(7);
                } else {
                    pe9Var.bindLong(7, r1.intValue());
                }
                if (allDebridAccount.getPremiumUntil() == null) {
                    pe9Var.bindNull(8);
                } else {
                    pe9Var.bindLong(8, allDebridAccount.getPremiumUntil().longValue());
                }
                if (allDebridAccount.getFidelityPoints() == null) {
                    pe9Var.bindNull(9);
                } else {
                    pe9Var.bindLong(9, allDebridAccount.getFidelityPoints().intValue());
                }
                pe9Var.bindLong(10, allDebridAccount.getLastVerifiedAt());
                pe9Var.bindLong(11, allDebridAccount.getCreatedAt());
            }
        };
        this.__preparedStmtOfDeleteAccount = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.AllDebridAccountDao_Impl.2
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM alldebrid_accounts WHERE providerId = ?";
            }
        };
    }

    @vo6
    public static List<Class<?>> getRequiredConverters() {
        return Collections.EMPTY_LIST;
    }

    @Override // com.strmr.ps.data.local.dao.AllDebridAccountDao
    public Object deleteAccount(final String str, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.AllDebridAccountDao_Impl.4
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = AllDebridAccountDao_Impl.this.__preparedStmtOfDeleteAccount.acquire();
                pe9VarAcquire.bindString(1, str);
                try {
                    AllDebridAccountDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        AllDebridAccountDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        AllDebridAccountDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    AllDebridAccountDao_Impl.this.__preparedStmtOfDeleteAccount.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.AllDebridAccountDao
    public Object getAccount(String str, Continuation<? super AllDebridAccount> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM alldebrid_accounts WHERE providerId = ? LIMIT 1");
        return mk1.c(this.__db, false, vw2.f(p58VarD, 1, str), new Callable<AllDebridAccount>() { // from class: com.strmr.ps.data.local.dao.AllDebridAccountDao_Impl.5
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public AllDebridAccount call() throws Exception {
                Boolean boolValueOf;
                Boolean boolValueOf2;
                Cursor cursorB = sp1.b(AllDebridAccountDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "providerId");
                    int iB2 = yn1.b(cursorB, "apiKey");
                    int iB3 = yn1.b(cursorB, "username");
                    int iB4 = yn1.b(cursorB, Scopes.EMAIL);
                    int iB5 = yn1.b(cursorB, "isPremium");
                    int iB6 = yn1.b(cursorB, "isSubscribed");
                    int iB7 = yn1.b(cursorB, "isTrial");
                    int iB8 = yn1.b(cursorB, "premiumUntil");
                    int iB9 = yn1.b(cursorB, "fidelityPoints");
                    int iB10 = yn1.b(cursorB, "lastVerifiedAt");
                    int iB11 = yn1.b(cursorB, "createdAt");
                    AllDebridAccount allDebridAccount = null;
                    if (cursorB.moveToFirst()) {
                        String string = cursorB.getString(iB);
                        String string2 = cursorB.getString(iB2);
                        String string3 = cursorB.isNull(iB3) ? null : cursorB.getString(iB3);
                        String string4 = cursorB.isNull(iB4) ? null : cursorB.getString(iB4);
                        boolean z = cursorB.getInt(iB5) != 0;
                        Integer numValueOf = cursorB.isNull(iB6) ? null : Integer.valueOf(cursorB.getInt(iB6));
                        if (numValueOf == null) {
                            boolValueOf = null;
                        } else {
                            boolValueOf = Boolean.valueOf(numValueOf.intValue() != 0);
                        }
                        Integer numValueOf2 = cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7));
                        if (numValueOf2 == null) {
                            boolValueOf2 = null;
                        } else {
                            boolValueOf2 = Boolean.valueOf(numValueOf2.intValue() != 0);
                        }
                        allDebridAccount = new AllDebridAccount(string, string2, string3, string4, z, boolValueOf, boolValueOf2, cursorB.isNull(iB8) ? null : Long.valueOf(cursorB.getLong(iB8)), cursorB.isNull(iB9) ? null : Integer.valueOf(cursorB.getInt(iB9)), cursorB.getLong(iB10), cursorB.getLong(iB11));
                    }
                    return allDebridAccount;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.AllDebridAccountDao
    public Object upsert(final AllDebridAccount allDebridAccount, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.AllDebridAccountDao_Impl.3
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                AllDebridAccountDao_Impl.this.__db.beginTransaction();
                try {
                    AllDebridAccountDao_Impl.this.__insertionAdapterOfAllDebridAccount.insert(allDebridAccount);
                    AllDebridAccountDao_Impl.this.__db.setTransactionSuccessful();
                    return e6a.a;
                } finally {
                    AllDebridAccountDao_Impl.this.__db.endTransaction();
                }
            }
        }, continuation);
    }
}
