package com.sistemasolton.itranvias.home.data.local.dao;

import androidx.room.EntityInsertAdapter;
import androidx.room.RoomDatabase;
import androidx.room.coroutines.FlowUtil;
import androidx.room.util.DBUtil;
import androidx.room.util.SQLiteStatementUtil;
import androidx.sqlite.SQLiteConnection;
import androidx.sqlite.SQLiteStatement;
import com.sistemasolton.itranvias.home.data.local.entity.StopFavoriteEntity;
import java.util.ArrayList;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.reflect.KClass;
import kotlinx.coroutines.flow.Flow;

/* JADX INFO: compiled from: StopFavoriteDao_Impl.kt */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\b\b\u0007\u0018\u0000 \u00192\u00020\u0001:\u0001\u0019B\u000f\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0004\b\u0004\u0010\u0005J\u0016\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\bH\u0096@¢\u0006\u0002\u0010\fJ\u0014\u0010\r\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\b0\u000f0\u000eH\u0016J\u0016\u0010\u0010\u001a\u00020\n2\u0006\u0010\u0011\u001a\u00020\u0012H\u0096@¢\u0006\u0002\u0010\u0013J \u0010\u0014\u001a\u00020\n2\u0006\u0010\u0011\u001a\u00020\u00122\b\u0010\u0015\u001a\u0004\u0018\u00010\u0012H\u0096@¢\u0006\u0002\u0010\u0016J\u000e\u0010\u0017\u001a\u00020\nH\u0096@¢\u0006\u0002\u0010\u0018R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001a"}, d2 = {"Lcom/sistemasolton/itranvias/home/data/local/dao/StopFavoriteDao_Impl;", "Lcom/sistemasolton/itranvias/home/data/local/dao/StopFavoriteDao;", "__db", "Landroidx/room/RoomDatabase;", "<init>", "(Landroidx/room/RoomDatabase;)V", "__insertAdapterOfStopFavoriteEntity", "Landroidx/room/EntityInsertAdapter;", "Lcom/sistemasolton/itranvias/home/data/local/entity/StopFavoriteEntity;", "addStopFavorite", "", "stop", "(Lcom/sistemasolton/itranvias/home/data/local/entity/StopFavoriteEntity;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "getAllStopsFavorite", "Lkotlinx/coroutines/flow/Flow;", "", "deleteFavoriteStopByCode", "stopCode", "", "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "updateStopAlias", "alias", "(Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "deleteAllStopsFavorite", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Companion", "composeApp_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
public final class StopFavoriteDao_Impl implements StopFavoriteDao {
    private final RoomDatabase __db;
    private final EntityInsertAdapter<StopFavoriteEntity> __insertAdapterOfStopFavoriteEntity;

    /* JADX INFO: renamed from: Companion, reason: from kotlin metadata */
    public static final Companion INSTANCE = new Companion(null);
    public static final int $stable = 8;

    public StopFavoriteDao_Impl(RoomDatabase __db) {
        Intrinsics.checkNotNullParameter(__db, "__db");
        this.__db = __db;
        this.__insertAdapterOfStopFavoriteEntity = new EntityInsertAdapter<StopFavoriteEntity>() { // from class: com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao_Impl.1
            @Override // androidx.room.EntityInsertAdapter
            protected String createQuery() {
                return "INSERT OR REPLACE INTO `stop_favorites` (`stopCode`,`alias`) VALUES (?,?)";
            }

            /* JADX INFO: Access modifiers changed from: protected */
            @Override // androidx.room.EntityInsertAdapter
            public void bind(SQLiteStatement statement, StopFavoriteEntity entity) {
                Intrinsics.checkNotNullParameter(statement, "statement");
                Intrinsics.checkNotNullParameter(entity, "entity");
                statement.mo7595bindText(1, entity.getStopCode());
                String alias = entity.getAlias();
                if (alias == null) {
                    statement.mo7594bindNull(2);
                } else {
                    statement.mo7595bindText(2, alias);
                }
            }
        };
    }

    @Override // com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao
    public Object addStopFavorite(final StopFavoriteEntity stopFavoriteEntity, Continuation<? super Unit> continuation) {
        Object objPerformSuspending = DBUtil.performSuspending(this.__db, false, true, new Function1() { // from class: com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao_Impl$$ExternalSyntheticLambda4
            @Override // kotlin.jvm.functions.Function1
            public final Object invoke(Object obj) {
                return StopFavoriteDao_Impl.addStopFavorite$lambda$0(this.f$0, stopFavoriteEntity, (SQLiteConnection) obj);
            }
        }, continuation);
        return objPerformSuspending == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? objPerformSuspending : Unit.INSTANCE;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Unit addStopFavorite$lambda$0(StopFavoriteDao_Impl stopFavoriteDao_Impl, StopFavoriteEntity stopFavoriteEntity, SQLiteConnection _connection) {
        Intrinsics.checkNotNullParameter(_connection, "_connection");
        stopFavoriteDao_Impl.__insertAdapterOfStopFavoriteEntity.insert(_connection, stopFavoriteEntity);
        return Unit.INSTANCE;
    }

    @Override // com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao
    public Flow<List<StopFavoriteEntity>> getAllStopsFavorite() {
        final String str = "SELECT * FROM stop_favorites";
        return FlowUtil.createFlow(this.__db, true, new String[]{"stop_favorites"}, new Function1() { // from class: com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao_Impl$$ExternalSyntheticLambda2
            @Override // kotlin.jvm.functions.Function1
            public final Object invoke(Object obj) {
                return StopFavoriteDao_Impl.getAllStopsFavorite$lambda$1(str, (SQLiteConnection) obj);
            }
        });
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final List getAllStopsFavorite$lambda$1(String str, SQLiteConnection _connection) {
        Intrinsics.checkNotNullParameter(_connection, "_connection");
        SQLiteStatement sQLiteStatementPrepare = _connection.prepare(str);
        try {
            int columnIndexOrThrow = SQLiteStatementUtil.getColumnIndexOrThrow(sQLiteStatementPrepare, "stopCode");
            int columnIndexOrThrow2 = SQLiteStatementUtil.getColumnIndexOrThrow(sQLiteStatementPrepare, "alias");
            ArrayList arrayList = new ArrayList();
            while (sQLiteStatementPrepare.step()) {
                arrayList.add(new StopFavoriteEntity(sQLiteStatementPrepare.getText(columnIndexOrThrow), sQLiteStatementPrepare.isNull(columnIndexOrThrow2) ? null : sQLiteStatementPrepare.getText(columnIndexOrThrow2)));
            }
            return arrayList;
        } finally {
            sQLiteStatementPrepare.close();
        }
    }

    @Override // com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao
    public Object deleteFavoriteStopByCode(final String str, Continuation<? super Unit> continuation) {
        final String str2 = "DELETE FROM stop_favorites WHERE stopCode = ?";
        Object objPerformSuspending = DBUtil.performSuspending(this.__db, false, true, new Function1() { // from class: com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao_Impl$$ExternalSyntheticLambda0
            @Override // kotlin.jvm.functions.Function1
            public final Object invoke(Object obj) {
                return StopFavoriteDao_Impl.deleteFavoriteStopByCode$lambda$2(str2, str, (SQLiteConnection) obj);
            }
        }, continuation);
        return objPerformSuspending == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? objPerformSuspending : Unit.INSTANCE;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Unit deleteFavoriteStopByCode$lambda$2(String str, String str2, SQLiteConnection _connection) {
        Intrinsics.checkNotNullParameter(_connection, "_connection");
        SQLiteStatement sQLiteStatementPrepare = _connection.prepare(str);
        try {
            sQLiteStatementPrepare.mo7595bindText(1, str2);
            sQLiteStatementPrepare.step();
            sQLiteStatementPrepare.close();
            return Unit.INSTANCE;
        } catch (Throwable th) {
            sQLiteStatementPrepare.close();
            throw th;
        }
    }

    @Override // com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao
    public Object updateStopAlias(final String str, final String str2, Continuation<? super Unit> continuation) {
        final String str3 = "UPDATE stop_favorites SET alias = ? WHERE stopCode = ?";
        Object objPerformSuspending = DBUtil.performSuspending(this.__db, false, true, new Function1() { // from class: com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao_Impl$$ExternalSyntheticLambda3
            @Override // kotlin.jvm.functions.Function1
            public final Object invoke(Object obj) {
                return StopFavoriteDao_Impl.updateStopAlias$lambda$3(str3, str2, str, (SQLiteConnection) obj);
            }
        }, continuation);
        return objPerformSuspending == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? objPerformSuspending : Unit.INSTANCE;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Unit updateStopAlias$lambda$3(String str, String str2, String str3, SQLiteConnection _connection) {
        Intrinsics.checkNotNullParameter(_connection, "_connection");
        SQLiteStatement sQLiteStatementPrepare = _connection.prepare(str);
        try {
            if (str2 == null) {
                sQLiteStatementPrepare.mo7594bindNull(1);
            } else {
                sQLiteStatementPrepare.mo7595bindText(1, str2);
            }
            sQLiteStatementPrepare.mo7595bindText(2, str3);
            sQLiteStatementPrepare.step();
            sQLiteStatementPrepare.close();
            return Unit.INSTANCE;
        } catch (Throwable th) {
            sQLiteStatementPrepare.close();
            throw th;
        }
    }

    @Override // com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao
    public Object deleteAllStopsFavorite(Continuation<? super Unit> continuation) {
        final String str = "DELETE FROM stop_favorites";
        Object objPerformSuspending = DBUtil.performSuspending(this.__db, false, true, new Function1() { // from class: com.sistemasolton.itranvias.home.data.local.dao.StopFavoriteDao_Impl$$ExternalSyntheticLambda1
            @Override // kotlin.jvm.functions.Function1
            public final Object invoke(Object obj) {
                return StopFavoriteDao_Impl.deleteAllStopsFavorite$lambda$4(str, (SQLiteConnection) obj);
            }
        }, continuation);
        return objPerformSuspending == IntrinsicsKt.getCOROUTINE_SUSPENDED() ? objPerformSuspending : Unit.INSTANCE;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final Unit deleteAllStopsFavorite$lambda$4(String str, SQLiteConnection _connection) {
        Intrinsics.checkNotNullParameter(_connection, "_connection");
        SQLiteStatement sQLiteStatementPrepare = _connection.prepare(str);
        try {
            sQLiteStatementPrepare.step();
            sQLiteStatementPrepare.close();
            return Unit.INSTANCE;
        } catch (Throwable th) {
            sQLiteStatementPrepare.close();
            throw th;
        }
    }

    /* JADX INFO: compiled from: StopFavoriteDao_Impl.kt */
    @Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J\u0010\u0010\u0004\u001a\f\u0012\b\u0012\u0006\u0012\u0002\b\u00030\u00060\u0005¨\u0006\u0007"}, d2 = {"Lcom/sistemasolton/itranvias/home/data/local/dao/StopFavoriteDao_Impl$Companion;", "", "<init>", "()V", "getRequiredConverters", "", "Lkotlin/reflect/KClass;", "composeApp_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
    public static final class Companion {
        public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final List<KClass<?>> getRequiredConverters() {
            return CollectionsKt.emptyList();
        }
    }
}