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.TorBoxAccount;
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 TorBoxAccountDao_Impl implements TorBoxAccountDao {
    private final RoomDatabase __db;
    private final xm2<TorBoxAccount> __insertionAdapterOfTorBoxAccount;
    private final oq8 __preparedStmtOfDeleteAccount;

    public TorBoxAccountDao_Impl(@vo6 RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
        this.__insertionAdapterOfTorBoxAccount = new xm2<TorBoxAccount>(roomDatabase) { // from class: com.strmr.ps.data.local.dao.TorBoxAccountDao_Impl.1
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "INSERT OR REPLACE INTO `torbox_accounts` (`providerId`,`apiKey`,`email`,`plan`,`planName`,`expiresAt`,`isSubscribed`,`totalDownloaded`,`userId`,`lastVerifiedAt`,`createdAt`) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
            }

            @Override // defpackage.xm2
            public void bind(@vo6 pe9 pe9Var, @vo6 TorBoxAccount torBoxAccount) {
                pe9Var.bindString(1, torBoxAccount.getProviderId());
                pe9Var.bindString(2, torBoxAccount.getApiKey());
                if (torBoxAccount.getEmail() == null) {
                    pe9Var.bindNull(3);
                } else {
                    pe9Var.bindString(3, torBoxAccount.getEmail());
                }
                pe9Var.bindLong(4, torBoxAccount.getPlan());
                if (torBoxAccount.getPlanName() == null) {
                    pe9Var.bindNull(5);
                } else {
                    pe9Var.bindString(5, torBoxAccount.getPlanName());
                }
                if (torBoxAccount.getExpiresAt() == null) {
                    pe9Var.bindNull(6);
                } else {
                    pe9Var.bindString(6, torBoxAccount.getExpiresAt());
                }
                pe9Var.bindLong(7, torBoxAccount.isSubscribed() ? 1L : 0L);
                if (torBoxAccount.getTotalDownloaded() == null) {
                    pe9Var.bindNull(8);
                } else {
                    pe9Var.bindLong(8, torBoxAccount.getTotalDownloaded().longValue());
                }
                if (torBoxAccount.getUserId() == null) {
                    pe9Var.bindNull(9);
                } else {
                    pe9Var.bindLong(9, torBoxAccount.getUserId().intValue());
                }
                pe9Var.bindLong(10, torBoxAccount.getLastVerifiedAt());
                pe9Var.bindLong(11, torBoxAccount.getCreatedAt());
            }
        };
        this.__preparedStmtOfDeleteAccount = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.TorBoxAccountDao_Impl.2
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM torbox_accounts WHERE providerId = ?";
            }
        };
    }

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

    @Override // com.strmr.ps.data.local.dao.TorBoxAccountDao
    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.TorBoxAccountDao_Impl.4
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = TorBoxAccountDao_Impl.this.__preparedStmtOfDeleteAccount.acquire();
                pe9VarAcquire.bindString(1, str);
                try {
                    TorBoxAccountDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        TorBoxAccountDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        TorBoxAccountDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    TorBoxAccountDao_Impl.this.__preparedStmtOfDeleteAccount.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.TorBoxAccountDao
    public Object getAccount(String str, Continuation<? super TorBoxAccount> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM torbox_accounts WHERE providerId = ? LIMIT 1");
        return mk1.c(this.__db, false, vw2.f(p58VarD, 1, str), new Callable<TorBoxAccount>() { // from class: com.strmr.ps.data.local.dao.TorBoxAccountDao_Impl.5
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public TorBoxAccount call() throws Exception {
                Cursor cursorB = sp1.b(TorBoxAccountDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "providerId");
                    int iB2 = yn1.b(cursorB, "apiKey");
                    int iB3 = yn1.b(cursorB, Scopes.EMAIL);
                    int iB4 = yn1.b(cursorB, "plan");
                    int iB5 = yn1.b(cursorB, "planName");
                    int iB6 = yn1.b(cursorB, "expiresAt");
                    int iB7 = yn1.b(cursorB, "isSubscribed");
                    int iB8 = yn1.b(cursorB, "totalDownloaded");
                    int iB9 = yn1.b(cursorB, "userId");
                    int iB10 = yn1.b(cursorB, "lastVerifiedAt");
                    int iB11 = yn1.b(cursorB, "createdAt");
                    TorBoxAccount torBoxAccount = null;
                    if (cursorB.moveToFirst()) {
                        torBoxAccount = new TorBoxAccount(cursorB.getString(iB), cursorB.getString(iB2), cursorB.isNull(iB3) ? null : cursorB.getString(iB3), cursorB.getInt(iB4), cursorB.isNull(iB5) ? null : cursorB.getString(iB5), cursorB.isNull(iB6) ? null : cursorB.getString(iB6), cursorB.getInt(iB7) != 0, 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 torBoxAccount;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

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