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

import android.database.Cursor;
import androidx.room.RoomDatabase;
import com.strmr.ps.data.local.entity.EasyDebridAccount;
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 EasyDebridAccountDao_Impl implements EasyDebridAccountDao {
    private final RoomDatabase __db;
    private final xm2<EasyDebridAccount> __insertionAdapterOfEasyDebridAccount;
    private final oq8 __preparedStmtOfDeleteAccount;

    public EasyDebridAccountDao_Impl(@vo6 RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
        this.__insertionAdapterOfEasyDebridAccount = new xm2<EasyDebridAccount>(roomDatabase) { // from class: com.strmr.ps.data.local.dao.EasyDebridAccountDao_Impl.1
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "INSERT OR REPLACE INTO `easydebrid_accounts` (`providerId`,`apiKey`,`userId`,`paidUntil`,`lastVerifiedAt`,`createdAt`) VALUES (?,?,?,?,?,?)";
            }

            @Override // defpackage.xm2
            public void bind(@vo6 pe9 pe9Var, @vo6 EasyDebridAccount easyDebridAccount) {
                pe9Var.bindString(1, easyDebridAccount.getProviderId());
                pe9Var.bindString(2, easyDebridAccount.getApiKey());
                if (easyDebridAccount.getUserId() == null) {
                    pe9Var.bindNull(3);
                } else {
                    pe9Var.bindString(3, easyDebridAccount.getUserId());
                }
                if (easyDebridAccount.getPaidUntil() == null) {
                    pe9Var.bindNull(4);
                } else {
                    pe9Var.bindLong(4, easyDebridAccount.getPaidUntil().longValue());
                }
                pe9Var.bindLong(5, easyDebridAccount.getLastVerifiedAt());
                pe9Var.bindLong(6, easyDebridAccount.getCreatedAt());
            }
        };
        this.__preparedStmtOfDeleteAccount = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.EasyDebridAccountDao_Impl.2
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM easydebrid_accounts WHERE providerId = ?";
            }
        };
    }

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

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

    @Override // com.strmr.ps.data.local.dao.EasyDebridAccountDao
    public Object getAccount(String str, Continuation<? super EasyDebridAccount> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM easydebrid_accounts WHERE providerId = ? LIMIT 1");
        return mk1.c(this.__db, false, vw2.f(p58VarD, 1, str), new Callable<EasyDebridAccount>() { // from class: com.strmr.ps.data.local.dao.EasyDebridAccountDao_Impl.5
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public EasyDebridAccount call() throws Exception {
                Cursor cursorB = sp1.b(EasyDebridAccountDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "providerId");
                    int iB2 = yn1.b(cursorB, "apiKey");
                    int iB3 = yn1.b(cursorB, "userId");
                    int iB4 = yn1.b(cursorB, "paidUntil");
                    int iB5 = yn1.b(cursorB, "lastVerifiedAt");
                    int iB6 = yn1.b(cursorB, "createdAt");
                    EasyDebridAccount easyDebridAccount = null;
                    if (cursorB.moveToFirst()) {
                        easyDebridAccount = new EasyDebridAccount(cursorB.getString(iB), cursorB.getString(iB2), cursorB.isNull(iB3) ? null : cursorB.getString(iB3), cursorB.isNull(iB4) ? null : Long.valueOf(cursorB.getLong(iB4)), cursorB.getLong(iB5), cursorB.getLong(iB6));
                    }
                    return easyDebridAccount;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

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