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

import android.database.Cursor;
import android.os.CancellationSignal;
import androidx.room.RoomDatabase;
import com.google.android.gms.common.Scopes;
import com.strmr.ps.data.local.entity.UserAccountEntity;
import defpackage.e6a;
import defpackage.j43;
import defpackage.mk1;
import defpackage.oq8;
import defpackage.p58;
import defpackage.pe9;
import defpackage.rq6;
import defpackage.sp1;
import defpackage.vo6;
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 UserAccountDao_Impl implements UserAccountDao {
    private final RoomDatabase __db;
    private final xm2<UserAccountEntity> __insertionAdapterOfUserAccountEntity;
    private final oq8 __preparedStmtOfDeleteAccount;
    private final oq8 __preparedStmtOfUpdateLastLogin;
    private final oq8 __preparedStmtOfUpdateSubscription;
    private final oq8 __preparedStmtOfUpdateTrial;

    public UserAccountDao_Impl(@vo6 RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
        this.__insertionAdapterOfUserAccountEntity = new xm2<UserAccountEntity>(roomDatabase) { // from class: com.strmr.ps.data.local.dao.UserAccountDao_Impl.1
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "INSERT OR REPLACE INTO `user_account` (`googleId`,`email`,`displayName`,`photoUrl`,`createdAt`,`lastLoginAt`,`subscriptionTier`,`subscriptionExpiresAt`,`trialStartedAt`,`trialExpiresAt`) VALUES (?,?,?,?,?,?,?,?,?,?)";
            }

            @Override // defpackage.xm2
            public void bind(@vo6 pe9 pe9Var, @vo6 UserAccountEntity userAccountEntity) {
                pe9Var.bindString(1, userAccountEntity.getGoogleId());
                pe9Var.bindString(2, userAccountEntity.getEmail());
                if (userAccountEntity.getDisplayName() == null) {
                    pe9Var.bindNull(3);
                } else {
                    pe9Var.bindString(3, userAccountEntity.getDisplayName());
                }
                if (userAccountEntity.getPhotoUrl() == null) {
                    pe9Var.bindNull(4);
                } else {
                    pe9Var.bindString(4, userAccountEntity.getPhotoUrl());
                }
                pe9Var.bindLong(5, userAccountEntity.getCreatedAt());
                pe9Var.bindLong(6, userAccountEntity.getLastLoginAt());
                pe9Var.bindString(7, userAccountEntity.getSubscriptionTier());
                if (userAccountEntity.getSubscriptionExpiresAt() == null) {
                    pe9Var.bindNull(8);
                } else {
                    pe9Var.bindLong(8, userAccountEntity.getSubscriptionExpiresAt().longValue());
                }
                if (userAccountEntity.getTrialStartedAt() == null) {
                    pe9Var.bindNull(9);
                } else {
                    pe9Var.bindLong(9, userAccountEntity.getTrialStartedAt().longValue());
                }
                if (userAccountEntity.getTrialExpiresAt() == null) {
                    pe9Var.bindNull(10);
                } else {
                    pe9Var.bindLong(10, userAccountEntity.getTrialExpiresAt().longValue());
                }
            }
        };
        this.__preparedStmtOfUpdateLastLogin = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.UserAccountDao_Impl.2
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "UPDATE user_account SET lastLoginAt = ? WHERE googleId = ?";
            }
        };
        this.__preparedStmtOfUpdateSubscription = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.UserAccountDao_Impl.3
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "\n        UPDATE user_account\n        SET subscriptionTier = ?,\n            subscriptionExpiresAt = ?\n        WHERE googleId = ?\n        ";
            }
        };
        this.__preparedStmtOfUpdateTrial = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.UserAccountDao_Impl.4
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "\n        UPDATE user_account\n        SET trialStartedAt = ?,\n            trialExpiresAt = ?\n        WHERE googleId = ?\n        ";
            }
        };
        this.__preparedStmtOfDeleteAccount = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.UserAccountDao_Impl.5
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM user_account";
            }
        };
    }

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

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

    @Override // com.strmr.ps.data.local.dao.UserAccountDao
    public Object getAccount(Continuation<? super UserAccountEntity> continuation) {
        final p58 p58VarD = p58.d(0, "SELECT * FROM user_account LIMIT 1");
        return mk1.c(this.__db, false, new CancellationSignal(), new Callable<UserAccountEntity>() { // from class: com.strmr.ps.data.local.dao.UserAccountDao_Impl.11
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public UserAccountEntity call() throws Exception {
                Cursor cursorB = sp1.b(UserAccountDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "googleId");
                    int iB2 = yn1.b(cursorB, Scopes.EMAIL);
                    int iB3 = yn1.b(cursorB, "displayName");
                    int iB4 = yn1.b(cursorB, "photoUrl");
                    int iB5 = yn1.b(cursorB, "createdAt");
                    int iB6 = yn1.b(cursorB, "lastLoginAt");
                    int iB7 = yn1.b(cursorB, "subscriptionTier");
                    int iB8 = yn1.b(cursorB, "subscriptionExpiresAt");
                    int iB9 = yn1.b(cursorB, "trialStartedAt");
                    int iB10 = yn1.b(cursorB, "trialExpiresAt");
                    UserAccountEntity userAccountEntity = null;
                    if (cursorB.moveToFirst()) {
                        userAccountEntity = new UserAccountEntity(cursorB.getString(iB), cursorB.getString(iB2), cursorB.isNull(iB3) ? null : cursorB.getString(iB3), cursorB.isNull(iB4) ? null : cursorB.getString(iB4), cursorB.getLong(iB5), cursorB.getLong(iB6), cursorB.getString(iB7), cursorB.isNull(iB8) ? null : Long.valueOf(cursorB.getLong(iB8)), cursorB.isNull(iB9) ? null : Long.valueOf(cursorB.getLong(iB9)), cursorB.isNull(iB10) ? null : Long.valueOf(cursorB.getLong(iB10)));
                    }
                    return userAccountEntity;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.UserAccountDao
    public Object hasAccount(Continuation<? super Boolean> continuation) {
        final p58 p58VarD = p58.d(0, "SELECT COUNT(*) > 0 FROM user_account");
        return mk1.c(this.__db, false, new CancellationSignal(), new Callable<Boolean>() { // from class: com.strmr.ps.data.local.dao.UserAccountDao_Impl.13
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public Boolean call() throws Exception {
                Boolean boolValueOf;
                Cursor cursorB = sp1.b(UserAccountDao_Impl.this.__db, p58VarD, false);
                try {
                    if (cursorB.moveToFirst()) {
                        boolValueOf = Boolean.valueOf(cursorB.getInt(0) != 0);
                    } else {
                        boolValueOf = Boolean.FALSE;
                    }
                    cursorB.close();
                    p58VarD.release();
                    return boolValueOf;
                } catch (Throwable th) {
                    cursorB.close();
                    p58VarD.release();
                    throw th;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.UserAccountDao
    public j43<UserAccountEntity> observeAccount() {
        final p58 p58VarD = p58.d(0, "SELECT * FROM user_account LIMIT 1");
        return mk1.a(this.__db, false, new String[]{"user_account"}, new Callable<UserAccountEntity>() { // from class: com.strmr.ps.data.local.dao.UserAccountDao_Impl.12
            public void finalize() {
                p58VarD.release();
            }

            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public UserAccountEntity call() throws Exception {
                Cursor cursorB = sp1.b(UserAccountDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "googleId");
                    int iB2 = yn1.b(cursorB, Scopes.EMAIL);
                    int iB3 = yn1.b(cursorB, "displayName");
                    int iB4 = yn1.b(cursorB, "photoUrl");
                    int iB5 = yn1.b(cursorB, "createdAt");
                    int iB6 = yn1.b(cursorB, "lastLoginAt");
                    int iB7 = yn1.b(cursorB, "subscriptionTier");
                    int iB8 = yn1.b(cursorB, "subscriptionExpiresAt");
                    int iB9 = yn1.b(cursorB, "trialStartedAt");
                    int iB10 = yn1.b(cursorB, "trialExpiresAt");
                    UserAccountEntity userAccountEntity = null;
                    if (cursorB.moveToFirst()) {
                        userAccountEntity = new UserAccountEntity(cursorB.getString(iB), cursorB.getString(iB2), cursorB.isNull(iB3) ? null : cursorB.getString(iB3), cursorB.isNull(iB4) ? null : cursorB.getString(iB4), cursorB.getLong(iB5), cursorB.getLong(iB6), cursorB.getString(iB7), cursorB.isNull(iB8) ? null : Long.valueOf(cursorB.getLong(iB8)), cursorB.isNull(iB9) ? null : Long.valueOf(cursorB.getLong(iB9)), cursorB.isNull(iB10) ? null : Long.valueOf(cursorB.getLong(iB10)));
                    }
                    return userAccountEntity;
                } finally {
                    cursorB.close();
                }
            }
        });
    }

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

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

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

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