package xyz.stream.download.db;

import androidx.annotation.NonNull;
import androidx.room.RoomDatabase;
import androidx.room.h;
import androidx.room.util.b;
import androidx.room.util.f;
import androidx.room.w0;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import k3.a;
import k3.c;
import xyz.stream.download.config.InnerConstant;

/* JADX INFO: loaded from: classes3.dex */
public final class FileInfoDao_Impl implements FileInfoDao {
    private final RoomDatabase __db;
    private final h __insertAdapterOfDownloadInfoEntity = new h() { // from class: xyz.stream.download.db.FileInfoDao_Impl.1
        @Override // androidx.room.h
        @NonNull
        public String createQuery() {
            return "INSERT OR REPLACE INTO `download_info` (`id`,`downloadUrl`,`filePath`,`size`,`downloadLocation`,`downloadStatus`) VALUES (?,?,?,?,?,?)";
        }

        @Override // androidx.room.h
        public void bind(@NonNull c cVar, DownloadInfoEntity downloadInfoEntity) {
            if (downloadInfoEntity.getId() == null) {
                cVar.d(1);
            } else {
                cVar.s(1, downloadInfoEntity.getId());
            }
            if (downloadInfoEntity.getDownloadUrl() == null) {
                cVar.d(2);
            } else {
                cVar.s(2, downloadInfoEntity.getDownloadUrl());
            }
            if (downloadInfoEntity.getFilePath() == null) {
                cVar.d(3);
            } else {
                cVar.s(3, downloadInfoEntity.getFilePath());
            }
            cVar.a(4, downloadInfoEntity.getSize());
            cVar.a(5, downloadInfoEntity.getDownloadLocation());
            cVar.a(6, downloadInfoEntity.getDownloadStatus());
        }
    };

    public FileInfoDao_Impl(@NonNull RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
    }

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

    /* JADX INFO: Access modifiers changed from: private */
    public static /* synthetic */ Object lambda$deleteById$4(String str, a aVar) throws Exception {
        c cVarJ = aVar.J("DELETE FROM download_info WHERE id = ?");
        try {
            if (str == null) {
                cVarJ.d(1);
            } else {
                cVarJ.s(1, str);
            }
            cVarJ.G();
            cVarJ.close();
            return null;
        } catch (Throwable th) {
            cVarJ.close();
            throw th;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static /* synthetic */ List lambda$getAll$2(a aVar) throws Exception {
        c cVarJ = aVar.J("SELECT * FROM download_info");
        try {
            int iC = f.c(cVarJ, InnerConstant.Db.f36069id);
            int iC2 = f.c(cVarJ, InnerConstant.Db.downloadUrl);
            int iC3 = f.c(cVarJ, InnerConstant.Db.filePath);
            int iC4 = f.c(cVarJ, InnerConstant.Db.size);
            int iC5 = f.c(cVarJ, InnerConstant.Db.downloadLocation);
            int iC6 = f.c(cVarJ, InnerConstant.Db.downloadStatus);
            ArrayList arrayList = new ArrayList();
            while (cVarJ.G()) {
                DownloadInfoEntity downloadInfoEntity = new DownloadInfoEntity();
                String strA = null;
                downloadInfoEntity.setId(cVarJ.isNull(iC) ? null : cVarJ.A(iC));
                downloadInfoEntity.setDownloadUrl(cVarJ.isNull(iC2) ? null : cVarJ.A(iC2));
                if (!cVarJ.isNull(iC3)) {
                    strA = cVarJ.A(iC3);
                }
                downloadInfoEntity.setFilePath(strA);
                downloadInfoEntity.setSize(cVarJ.getLong(iC4));
                downloadInfoEntity.setDownloadLocation(cVarJ.getLong(iC5));
                downloadInfoEntity.setDownloadStatus((int) cVarJ.getLong(iC6));
                arrayList.add(downloadInfoEntity);
            }
            return arrayList;
        } finally {
            cVarJ.close();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static /* synthetic */ DownloadInfoEntity lambda$getById$1(String str, a aVar) throws Exception {
        c cVarJ = aVar.J("SELECT * FROM download_info WHERE id = ? LIMIT 1");
        try {
            if (str == null) {
                cVarJ.d(1);
            } else {
                cVarJ.s(1, str);
            }
            int iC = f.c(cVarJ, InnerConstant.Db.f36069id);
            int iC2 = f.c(cVarJ, InnerConstant.Db.downloadUrl);
            int iC3 = f.c(cVarJ, InnerConstant.Db.filePath);
            int iC4 = f.c(cVarJ, InnerConstant.Db.size);
            int iC5 = f.c(cVarJ, InnerConstant.Db.downloadLocation);
            int iC6 = f.c(cVarJ, InnerConstant.Db.downloadStatus);
            DownloadInfoEntity downloadInfoEntity = null;
            String strA = null;
            if (cVarJ.G()) {
                DownloadInfoEntity downloadInfoEntity2 = new DownloadInfoEntity();
                downloadInfoEntity2.setId(cVarJ.isNull(iC) ? null : cVarJ.A(iC));
                downloadInfoEntity2.setDownloadUrl(cVarJ.isNull(iC2) ? null : cVarJ.A(iC2));
                if (!cVarJ.isNull(iC3)) {
                    strA = cVarJ.A(iC3);
                }
                downloadInfoEntity2.setFilePath(strA);
                downloadInfoEntity2.setSize(cVarJ.getLong(iC4));
                downloadInfoEntity2.setDownloadLocation(cVarJ.getLong(iC5));
                downloadInfoEntity2.setDownloadStatus((int) cVarJ.getLong(iC6));
                downloadInfoEntity = downloadInfoEntity2;
            }
            cVarJ.close();
            return downloadInfoEntity;
        } catch (Throwable th) {
            cVarJ.close();
            throw th;
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ Object lambda$save$0(DownloadInfoEntity downloadInfoEntity, a aVar) {
        this.__insertAdapterOfDownloadInfoEntity.insert(aVar, downloadInfoEntity);
        return null;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static /* synthetic */ Object lambda$updateState$3(int i10, String str, a aVar) throws Exception {
        c cVarJ = aVar.J("UPDATE download_info SET downloadStatus = ? WHERE id = ?");
        try {
            cVarJ.a(1, i10);
            if (str == null) {
                cVarJ.d(2);
            } else {
                cVarJ.s(2, str);
            }
            cVarJ.G();
            cVarJ.close();
            return null;
        } catch (Throwable th) {
            cVarJ.close();
            throw th;
        }
    }

    @Override // xyz.stream.download.db.FileInfoDao
    public void deleteById(String str) {
        b.b(this.__db, false, true, new h3.b(str, 8));
    }

    @Override // xyz.stream.download.db.FileInfoDao
    public List<DownloadInfoEntity> getAll() {
        return (List) b.b(this.__db, true, false, new w0(10));
    }

    @Override // xyz.stream.download.db.FileInfoDao
    public DownloadInfoEntity getById(String str) {
        return (DownloadInfoEntity) b.b(this.__db, true, false, new h3.b(str, 7));
    }

    @Override // xyz.stream.download.db.FileInfoDao
    public void save(DownloadInfoEntity downloadInfoEntity) {
        b.b(this.__db, false, true, new h3.c(this, downloadInfoEntity, 4));
    }

    @Override // xyz.stream.download.db.FileInfoDao
    public void updateState(String str, int i10) {
        b.b(this.__db, false, true, new vf.b(i10, 6, str));
    }
}
