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

import android.database.Cursor;
import android.os.CancellationSignal;
import androidx.media3.exoplayer.rtsp.SessionDescription;
import androidx.room.RoomDatabase;
import com.strmr.ps.data.local.entity.WatchStatusEntity;
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.ArrayList;
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 WatchStatusDao_Impl implements WatchStatusDao {
    private final RoomDatabase __db;
    private final xm2<WatchStatusEntity> __insertionAdapterOfWatchStatusEntity;
    private final oq8 __preparedStmtOfClear;
    private final oq8 __preparedStmtOfClearForUser;

    public WatchStatusDao_Impl(@vo6 RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
        this.__insertionAdapterOfWatchStatusEntity = new xm2<WatchStatusEntity>(roomDatabase) { // from class: com.strmr.ps.data.local.dao.WatchStatusDao_Impl.1
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "INSERT OR REPLACE INTO `watch_status` (`key`,`userSlug`,`tmdbId`,`type`,`progress`,`updatedAt`,`lastWatched`,`nextEpisodeTitle`,`nextEpisodeSeason`,`nextEpisodeNumber`,`nextEpisodeTmdbId`) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
            }

            @Override // defpackage.xm2
            public void bind(@vo6 pe9 pe9Var, @vo6 WatchStatusEntity watchStatusEntity) {
                pe9Var.bindString(1, watchStatusEntity.getKey());
                pe9Var.bindString(2, watchStatusEntity.getUserSlug());
                pe9Var.bindLong(3, watchStatusEntity.getTmdbId());
                pe9Var.bindString(4, watchStatusEntity.getType());
                if (watchStatusEntity.getProgress() == null) {
                    pe9Var.bindNull(5);
                } else {
                    pe9Var.bindDouble(5, watchStatusEntity.getProgress().doubleValue());
                }
                pe9Var.bindLong(6, watchStatusEntity.getUpdatedAt());
                if (watchStatusEntity.getLastWatched() == null) {
                    pe9Var.bindNull(7);
                } else {
                    pe9Var.bindLong(7, watchStatusEntity.getLastWatched().longValue());
                }
                if (watchStatusEntity.getNextEpisodeTitle() == null) {
                    pe9Var.bindNull(8);
                } else {
                    pe9Var.bindString(8, watchStatusEntity.getNextEpisodeTitle());
                }
                if (watchStatusEntity.getNextEpisodeSeason() == null) {
                    pe9Var.bindNull(9);
                } else {
                    pe9Var.bindLong(9, watchStatusEntity.getNextEpisodeSeason().intValue());
                }
                if (watchStatusEntity.getNextEpisodeNumber() == null) {
                    pe9Var.bindNull(10);
                } else {
                    pe9Var.bindLong(10, watchStatusEntity.getNextEpisodeNumber().intValue());
                }
                if (watchStatusEntity.getNextEpisodeTmdbId() == null) {
                    pe9Var.bindNull(11);
                } else {
                    pe9Var.bindLong(11, watchStatusEntity.getNextEpisodeTmdbId().intValue());
                }
            }
        };
        this.__preparedStmtOfClearForUser = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.WatchStatusDao_Impl.2
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM watch_status WHERE userSlug = ?";
            }
        };
        this.__preparedStmtOfClear = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.WatchStatusDao_Impl.3
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM watch_status";
            }
        };
    }

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

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

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

    @Override // com.strmr.ps.data.local.dao.WatchStatusDao
    public Object getAll(Continuation<? super List<WatchStatusEntity>> continuation) {
        final p58 p58VarD = p58.d(0, "SELECT * FROM watch_status");
        return mk1.c(this.__db, false, new CancellationSignal(), new Callable<List<WatchStatusEntity>>() { // from class: com.strmr.ps.data.local.dao.WatchStatusDao_Impl.10
            @Override // java.util.concurrent.Callable
            @vo6
            public List<WatchStatusEntity> call() throws Exception {
                Cursor cursorB = sp1.b(WatchStatusDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "key");
                    int iB2 = yn1.b(cursorB, "userSlug");
                    int iB3 = yn1.b(cursorB, "tmdbId");
                    int iB4 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB5 = yn1.b(cursorB, "progress");
                    int iB6 = yn1.b(cursorB, "updatedAt");
                    int iB7 = yn1.b(cursorB, "lastWatched");
                    int iB8 = yn1.b(cursorB, "nextEpisodeTitle");
                    int iB9 = yn1.b(cursorB, "nextEpisodeSeason");
                    int iB10 = yn1.b(cursorB, "nextEpisodeNumber");
                    int iB11 = yn1.b(cursorB, "nextEpisodeTmdbId");
                    ArrayList arrayList = new ArrayList(cursorB.getCount());
                    while (cursorB.moveToNext()) {
                        arrayList.add(new WatchStatusEntity(cursorB.getString(iB), cursorB.getString(iB2), cursorB.getInt(iB3), cursorB.getString(iB4), cursorB.isNull(iB5) ? null : Double.valueOf(cursorB.getDouble(iB5)), cursorB.getLong(iB6), cursorB.isNull(iB7) ? null : Long.valueOf(cursorB.getLong(iB7)), cursorB.isNull(iB8) ? null : cursorB.getString(iB8), cursorB.isNull(iB9) ? null : Integer.valueOf(cursorB.getInt(iB9)), cursorB.isNull(iB10) ? null : Integer.valueOf(cursorB.getInt(iB10)), cursorB.isNull(iB11) ? null : Integer.valueOf(cursorB.getInt(iB11))));
                    }
                    return arrayList;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.WatchStatusDao
    public Object getAllForUser(String str, Continuation<? super List<WatchStatusEntity>> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM watch_status WHERE userSlug = ?");
        return mk1.c(this.__db, false, vw2.f(p58VarD, 1, str), new Callable<List<WatchStatusEntity>>() { // from class: com.strmr.ps.data.local.dao.WatchStatusDao_Impl.8
            @Override // java.util.concurrent.Callable
            @vo6
            public List<WatchStatusEntity> call() throws Exception {
                Cursor cursorB = sp1.b(WatchStatusDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "key");
                    int iB2 = yn1.b(cursorB, "userSlug");
                    int iB3 = yn1.b(cursorB, "tmdbId");
                    int iB4 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB5 = yn1.b(cursorB, "progress");
                    int iB6 = yn1.b(cursorB, "updatedAt");
                    int iB7 = yn1.b(cursorB, "lastWatched");
                    int iB8 = yn1.b(cursorB, "nextEpisodeTitle");
                    int iB9 = yn1.b(cursorB, "nextEpisodeSeason");
                    int iB10 = yn1.b(cursorB, "nextEpisodeNumber");
                    int iB11 = yn1.b(cursorB, "nextEpisodeTmdbId");
                    ArrayList arrayList = new ArrayList(cursorB.getCount());
                    while (cursorB.moveToNext()) {
                        arrayList.add(new WatchStatusEntity(cursorB.getString(iB), cursorB.getString(iB2), cursorB.getInt(iB3), cursorB.getString(iB4), cursorB.isNull(iB5) ? null : Double.valueOf(cursorB.getDouble(iB5)), cursorB.getLong(iB6), cursorB.isNull(iB7) ? null : Long.valueOf(cursorB.getLong(iB7)), cursorB.isNull(iB8) ? null : cursorB.getString(iB8), cursorB.isNull(iB9) ? null : Integer.valueOf(cursorB.getInt(iB9)), cursorB.isNull(iB10) ? null : Integer.valueOf(cursorB.getInt(iB10)), cursorB.isNull(iB11) ? null : Integer.valueOf(cursorB.getInt(iB11))));
                    }
                    return arrayList;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.WatchStatusDao
    public Object getByKey(String str, Continuation<? super WatchStatusEntity> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM watch_status WHERE key = ? LIMIT 1");
        return mk1.c(this.__db, false, vw2.f(p58VarD, 1, str), new Callable<WatchStatusEntity>() { // from class: com.strmr.ps.data.local.dao.WatchStatusDao_Impl.7
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public WatchStatusEntity call() throws Exception {
                Cursor cursorB = sp1.b(WatchStatusDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "key");
                    int iB2 = yn1.b(cursorB, "userSlug");
                    int iB3 = yn1.b(cursorB, "tmdbId");
                    int iB4 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB5 = yn1.b(cursorB, "progress");
                    int iB6 = yn1.b(cursorB, "updatedAt");
                    int iB7 = yn1.b(cursorB, "lastWatched");
                    int iB8 = yn1.b(cursorB, "nextEpisodeTitle");
                    int iB9 = yn1.b(cursorB, "nextEpisodeSeason");
                    int iB10 = yn1.b(cursorB, "nextEpisodeNumber");
                    int iB11 = yn1.b(cursorB, "nextEpisodeTmdbId");
                    WatchStatusEntity watchStatusEntity = null;
                    if (cursorB.moveToFirst()) {
                        watchStatusEntity = new WatchStatusEntity(cursorB.getString(iB), cursorB.getString(iB2), cursorB.getInt(iB3), cursorB.getString(iB4), cursorB.isNull(iB5) ? null : Double.valueOf(cursorB.getDouble(iB5)), cursorB.getLong(iB6), cursorB.isNull(iB7) ? null : Long.valueOf(cursorB.getLong(iB7)), cursorB.isNull(iB8) ? null : cursorB.getString(iB8), cursorB.isNull(iB9) ? null : Integer.valueOf(cursorB.getInt(iB9)), cursorB.isNull(iB10) ? null : Integer.valueOf(cursorB.getInt(iB10)), cursorB.isNull(iB11) ? null : Integer.valueOf(cursorB.getInt(iB11)));
                    }
                    return watchStatusEntity;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.WatchStatusDao
    public Object getByUserAndContent(String str, int i, String str2, Continuation<? super WatchStatusEntity> continuation) {
        final p58 p58VarD = p58.d(3, "SELECT * FROM watch_status WHERE userSlug = ? AND tmdbId = ? AND type = ? LIMIT 1");
        p58VarD.bindString(1, str);
        p58VarD.bindLong(2, i);
        return mk1.c(this.__db, false, vw2.f(p58VarD, 3, str2), new Callable<WatchStatusEntity>() { // from class: com.strmr.ps.data.local.dao.WatchStatusDao_Impl.9
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public WatchStatusEntity call() throws Exception {
                Cursor cursorB = sp1.b(WatchStatusDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, "key");
                    int iB2 = yn1.b(cursorB, "userSlug");
                    int iB3 = yn1.b(cursorB, "tmdbId");
                    int iB4 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB5 = yn1.b(cursorB, "progress");
                    int iB6 = yn1.b(cursorB, "updatedAt");
                    int iB7 = yn1.b(cursorB, "lastWatched");
                    int iB8 = yn1.b(cursorB, "nextEpisodeTitle");
                    int iB9 = yn1.b(cursorB, "nextEpisodeSeason");
                    int iB10 = yn1.b(cursorB, "nextEpisodeNumber");
                    int iB11 = yn1.b(cursorB, "nextEpisodeTmdbId");
                    WatchStatusEntity watchStatusEntity = null;
                    if (cursorB.moveToFirst()) {
                        watchStatusEntity = new WatchStatusEntity(cursorB.getString(iB), cursorB.getString(iB2), cursorB.getInt(iB3), cursorB.getString(iB4), cursorB.isNull(iB5) ? null : Double.valueOf(cursorB.getDouble(iB5)), cursorB.getLong(iB6), cursorB.isNull(iB7) ? null : Long.valueOf(cursorB.getLong(iB7)), cursorB.isNull(iB8) ? null : cursorB.getString(iB8), cursorB.isNull(iB9) ? null : Integer.valueOf(cursorB.getInt(iB9)), cursorB.isNull(iB10) ? null : Integer.valueOf(cursorB.getInt(iB10)), cursorB.isNull(iB11) ? null : Integer.valueOf(cursorB.getInt(iB11)));
                    }
                    return watchStatusEntity;
                } finally {
                    cursorB.close();
                    p58VarD.release();
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.WatchStatusDao
    public Object upsertAll(final List<WatchStatusEntity> list, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.WatchStatusDao_Impl.4
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                WatchStatusDao_Impl.this.__db.beginTransaction();
                try {
                    WatchStatusDao_Impl.this.__insertionAdapterOfWatchStatusEntity.insert((Iterable) list);
                    WatchStatusDao_Impl.this.__db.setTransactionSuccessful();
                    return e6a.a;
                } finally {
                    WatchStatusDao_Impl.this.__db.endTransaction();
                }
            }
        }, continuation);
    }
}
