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.RealDebridAccount;
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 RealDebridAccountDao_Impl implements RealDebridAccountDao {
    private final RoomDatabase __db;
    private final xm2<RealDebridAccount> __insertionAdapterOfRealDebridAccount;
    private final oq8 __preparedStmtOfDeleteAccount;
    private final oq8 __preparedStmtOfExpireToken;
    private final oq8 __preparedStmtOfMarkAuthInvalid;
    private final oq8 __preparedStmtOfMarkAuthValid;
    private final oq8 __preparedStmtOfUpdatePremiumStatus;
    private final oq8 __preparedStmtOfUpdateTokens;

    public RealDebridAccountDao_Impl(@vo6 RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
        this.__insertionAdapterOfRealDebridAccount = new xm2<RealDebridAccount>(roomDatabase) { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.1
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "INSERT OR REPLACE INTO `realdebrid_accounts` (`providerId`,`accessToken`,`refreshToken`,`clientId`,`clientSecret`,`tokenExpiresAt`,`userId`,`username`,`email`,`accountType`,`premiumDaysRemaining`,`expiresAt`,`points`,`lastVerifiedAt`,`createdAt`,`isAuthValid`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
            }

            @Override // defpackage.xm2
            public void bind(@vo6 pe9 pe9Var, @vo6 RealDebridAccount realDebridAccount) {
                pe9Var.bindString(1, realDebridAccount.getProviderId());
                pe9Var.bindString(2, realDebridAccount.getAccessToken());
                if (realDebridAccount.getRefreshToken() == null) {
                    pe9Var.bindNull(3);
                } else {
                    pe9Var.bindString(3, realDebridAccount.getRefreshToken());
                }
                pe9Var.bindString(4, realDebridAccount.getClientId());
                pe9Var.bindString(5, realDebridAccount.getClientSecret());
                if (realDebridAccount.getTokenExpiresAt() == null) {
                    pe9Var.bindNull(6);
                } else {
                    pe9Var.bindLong(6, realDebridAccount.getTokenExpiresAt().longValue());
                }
                if (realDebridAccount.getUserId() == null) {
                    pe9Var.bindNull(7);
                } else {
                    pe9Var.bindLong(7, realDebridAccount.getUserId().intValue());
                }
                if (realDebridAccount.getUsername() == null) {
                    pe9Var.bindNull(8);
                } else {
                    pe9Var.bindString(8, realDebridAccount.getUsername());
                }
                if (realDebridAccount.getEmail() == null) {
                    pe9Var.bindNull(9);
                } else {
                    pe9Var.bindString(9, realDebridAccount.getEmail());
                }
                if (realDebridAccount.getAccountType() == null) {
                    pe9Var.bindNull(10);
                } else {
                    pe9Var.bindString(10, realDebridAccount.getAccountType());
                }
                if (realDebridAccount.getPremiumDaysRemaining() == null) {
                    pe9Var.bindNull(11);
                } else {
                    pe9Var.bindLong(11, realDebridAccount.getPremiumDaysRemaining().intValue());
                }
                if (realDebridAccount.getExpiresAt() == null) {
                    pe9Var.bindNull(12);
                } else {
                    pe9Var.bindLong(12, realDebridAccount.getExpiresAt().longValue());
                }
                if (realDebridAccount.getPoints() == null) {
                    pe9Var.bindNull(13);
                } else {
                    pe9Var.bindLong(13, realDebridAccount.getPoints().intValue());
                }
                pe9Var.bindLong(14, realDebridAccount.getLastVerifiedAt());
                pe9Var.bindLong(15, realDebridAccount.getCreatedAt());
                pe9Var.bindLong(16, realDebridAccount.isAuthValid() ? 1L : 0L);
            }
        };
        this.__preparedStmtOfDeleteAccount = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.2
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM realdebrid_accounts WHERE providerId = ?";
            }
        };
        this.__preparedStmtOfUpdateTokens = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.3
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "\n        UPDATE realdebrid_accounts\n        SET accessToken = ?,\n            refreshToken = ?,\n            tokenExpiresAt = ?,\n            isAuthValid = 1\n        WHERE providerId = ?\n    ";
            }
        };
        this.__preparedStmtOfMarkAuthInvalid = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.4
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "UPDATE realdebrid_accounts SET isAuthValid = 0 WHERE providerId = ?";
            }
        };
        this.__preparedStmtOfMarkAuthValid = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.5
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "UPDATE realdebrid_accounts SET isAuthValid = 1 WHERE providerId = ?";
            }
        };
        this.__preparedStmtOfExpireToken = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.6
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "UPDATE realdebrid_accounts SET tokenExpiresAt = 0 WHERE providerId = ? AND tokenExpiresAt IS NOT NULL";
            }
        };
        this.__preparedStmtOfUpdatePremiumStatus = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.7
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "\n        UPDATE realdebrid_accounts\n        SET expiresAt = ?,\n            premiumDaysRemaining = ?,\n            accountType = ?\n        WHERE providerId = ?\n    ";
            }
        };
    }

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

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

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

    @Override // com.strmr.ps.data.local.dao.RealDebridAccountDao
    public Object getAccount(String str, Continuation<? super RealDebridAccount> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM realdebrid_accounts WHERE providerId = ? LIMIT 1");
        return mk1.c(this.__db, false, vw2.f(p58VarD, 1, str), new Callable<RealDebridAccount>() { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.15
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public RealDebridAccount call() throws Exception {
                int iB;
                int iB2;
                int iB3;
                int iB4;
                int iB5;
                int iB6;
                int iB7;
                int iB8;
                int iB9;
                int iB10;
                int iB11;
                int iB12;
                int iB13;
                int iB14;
                AnonymousClass15 anonymousClass15 = this;
                Cursor cursorB = sp1.b(RealDebridAccountDao_Impl.this.__db, p58VarD, false);
                try {
                    iB = yn1.b(cursorB, "providerId");
                    iB2 = yn1.b(cursorB, "accessToken");
                    iB3 = yn1.b(cursorB, "refreshToken");
                    iB4 = yn1.b(cursorB, "clientId");
                    iB5 = yn1.b(cursorB, "clientSecret");
                    iB6 = yn1.b(cursorB, "tokenExpiresAt");
                    iB7 = yn1.b(cursorB, "userId");
                    iB8 = yn1.b(cursorB, "username");
                    iB9 = yn1.b(cursorB, Scopes.EMAIL);
                    iB10 = yn1.b(cursorB, "accountType");
                    iB11 = yn1.b(cursorB, "premiumDaysRemaining");
                    iB12 = yn1.b(cursorB, "expiresAt");
                    iB13 = yn1.b(cursorB, "points");
                    iB14 = yn1.b(cursorB, "lastVerifiedAt");
                } catch (Throwable th) {
                    th = th;
                }
                try {
                    int iB15 = yn1.b(cursorB, "createdAt");
                    int iB16 = yn1.b(cursorB, "isAuthValid");
                    RealDebridAccount realDebridAccount = null;
                    if (cursorB.moveToFirst()) {
                        realDebridAccount = new RealDebridAccount(cursorB.getString(iB), cursorB.getString(iB2), cursorB.isNull(iB3) ? null : cursorB.getString(iB3), cursorB.getString(iB4), cursorB.getString(iB5), cursorB.isNull(iB6) ? null : Long.valueOf(cursorB.getLong(iB6)), cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7)), cursorB.isNull(iB8) ? null : cursorB.getString(iB8), cursorB.isNull(iB9) ? null : cursorB.getString(iB9), cursorB.isNull(iB10) ? null : cursorB.getString(iB10), cursorB.isNull(iB11) ? null : Integer.valueOf(cursorB.getInt(iB11)), cursorB.isNull(iB12) ? null : Long.valueOf(cursorB.getLong(iB12)), cursorB.isNull(iB13) ? null : Integer.valueOf(cursorB.getInt(iB13)), cursorB.getLong(iB14), cursorB.getLong(iB15), cursorB.getInt(iB16) != 0);
                    }
                    cursorB.close();
                    p58VarD.release();
                    return realDebridAccount;
                } catch (Throwable th2) {
                    th = th2;
                    anonymousClass15 = this;
                    cursorB.close();
                    p58VarD.release();
                    throw th;
                }
            }
        }, continuation);
    }

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

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

    @Override // com.strmr.ps.data.local.dao.RealDebridAccountDao
    public Object updatePremiumStatus(final Long l, final Integer num, final String str, final String str2, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.14
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = RealDebridAccountDao_Impl.this.__preparedStmtOfUpdatePremiumStatus.acquire();
                Long l2 = l;
                if (l2 == null) {
                    pe9VarAcquire.bindNull(1);
                } else {
                    pe9VarAcquire.bindLong(1, l2.longValue());
                }
                if (num == null) {
                    pe9VarAcquire.bindNull(2);
                } else {
                    pe9VarAcquire.bindLong(2, r1.intValue());
                }
                String str3 = str;
                if (str3 == null) {
                    pe9VarAcquire.bindNull(3);
                } else {
                    pe9VarAcquire.bindString(3, str3);
                }
                pe9VarAcquire.bindString(4, str2);
                try {
                    RealDebridAccountDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        RealDebridAccountDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        RealDebridAccountDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    RealDebridAccountDao_Impl.this.__preparedStmtOfUpdatePremiumStatus.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.RealDebridAccountDao
    public Object updateTokens(final String str, final String str2, final Long l, final String str3, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.RealDebridAccountDao_Impl.10
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = RealDebridAccountDao_Impl.this.__preparedStmtOfUpdateTokens.acquire();
                pe9VarAcquire.bindString(1, str);
                String str4 = str2;
                if (str4 == null) {
                    pe9VarAcquire.bindNull(2);
                } else {
                    pe9VarAcquire.bindString(2, str4);
                }
                Long l2 = l;
                if (l2 == null) {
                    pe9VarAcquire.bindNull(3);
                } else {
                    pe9VarAcquire.bindLong(3, l2.longValue());
                }
                pe9VarAcquire.bindString(4, str3);
                try {
                    RealDebridAccountDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        RealDebridAccountDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        RealDebridAccountDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    RealDebridAccountDao_Impl.this.__preparedStmtOfUpdateTokens.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

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