package com.rssuper.database.daos;

import android.database.Cursor;
import android.os.CancellationSignal;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.CoroutinesRoom;
import androidx.room.EntityDeletionOrUpdateAdapter;
import androidx.room.EntityInsertionAdapter;
import androidx.room.RoomDatabase;
import androidx.room.RoomSQLiteQuery;
import androidx.room.SharedSQLiteStatement;
import androidx.room.util.CursorUtil;
import androidx.room.util.DBUtil;
import androidx.sqlite.db.SupportSQLiteStatement;
import com.rssuper.converters.DateConverter;
import com.rssuper.database.entities.SubscriptionEntity;
import java.lang.Class;
import java.lang.Exception;
import java.lang.Integer;
import java.lang.Long;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import javax.annotation.processing.Generated;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlinx.coroutines.flow.Flow;

@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation"})
public final class SubscriptionDao_Impl implements SubscriptionDao {
  private final RoomDatabase __db;

  private final EntityInsertionAdapter<SubscriptionEntity> __insertionAdapterOfSubscriptionEntity;

  private final DateConverter __dateConverter = new DateConverter();

  private final EntityDeletionOrUpdateAdapter<SubscriptionEntity> __deletionAdapterOfSubscriptionEntity;

  private final EntityDeletionOrUpdateAdapter<SubscriptionEntity> __updateAdapterOfSubscriptionEntity;

  private final SharedSQLiteStatement __preparedStmtOfDeleteSubscriptionById;

  private final SharedSQLiteStatement __preparedStmtOfUpdateError;

  private final SharedSQLiteStatement __preparedStmtOfUpdateLastFetchedAt;

  private final SharedSQLiteStatement __preparedStmtOfUpdateNextFetchAt;

  public SubscriptionDao_Impl(@NonNull final RoomDatabase __db) {
    this.__db = __db;
    this.__insertionAdapterOfSubscriptionEntity = new EntityInsertionAdapter<SubscriptionEntity>(__db) {
      @Override
      @NonNull
      protected String createQuery() {
        return "INSERT OR REPLACE INTO `subscriptions` (`id`,`url`,`title`,`category`,`enabled`,`fetchInterval`,`createdAt`,`updatedAt`,`lastFetchedAt`,`nextFetchAt`,`error`,`httpAuthUsername`,`httpAuthPassword`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
      }

      @Override
      protected void bind(@NonNull final SupportSQLiteStatement statement,
          @NonNull final SubscriptionEntity entity) {
        if (entity.getId() == null) {
          statement.bindNull(1);
        } else {
          statement.bindString(1, entity.getId());
        }
        if (entity.getUrl() == null) {
          statement.bindNull(2);
        } else {
          statement.bindString(2, entity.getUrl());
        }
        if (entity.getTitle() == null) {
          statement.bindNull(3);
        } else {
          statement.bindString(3, entity.getTitle());
        }
        if (entity.getCategory() == null) {
          statement.bindNull(4);
        } else {
          statement.bindString(4, entity.getCategory());
        }
        final int _tmp = entity.getEnabled() ? 1 : 0;
        statement.bindLong(5, _tmp);
        statement.bindLong(6, entity.getFetchInterval());
        final Long _tmp_1 = __dateConverter.dateToTimestamp(entity.getCreatedAt());
        if (_tmp_1 == null) {
          statement.bindNull(7);
        } else {
          statement.bindLong(7, _tmp_1);
        }
        final Long _tmp_2 = __dateConverter.dateToTimestamp(entity.getUpdatedAt());
        if (_tmp_2 == null) {
          statement.bindNull(8);
        } else {
          statement.bindLong(8, _tmp_2);
        }
        final Long _tmp_3 = __dateConverter.dateToTimestamp(entity.getLastFetchedAt());
        if (_tmp_3 == null) {
          statement.bindNull(9);
        } else {
          statement.bindLong(9, _tmp_3);
        }
        final Long _tmp_4 = __dateConverter.dateToTimestamp(entity.getNextFetchAt());
        if (_tmp_4 == null) {
          statement.bindNull(10);
        } else {
          statement.bindLong(10, _tmp_4);
        }
        if (entity.getError() == null) {
          statement.bindNull(11);
        } else {
          statement.bindString(11, entity.getError());
        }
        if (entity.getHttpAuthUsername() == null) {
          statement.bindNull(12);
        } else {
          statement.bindString(12, entity.getHttpAuthUsername());
        }
        if (entity.getHttpAuthPassword() == null) {
          statement.bindNull(13);
        } else {
          statement.bindString(13, entity.getHttpAuthPassword());
        }
      }
    };
    this.__deletionAdapterOfSubscriptionEntity = new EntityDeletionOrUpdateAdapter<SubscriptionEntity>(__db) {
      @Override
      @NonNull
      protected String createQuery() {
        return "DELETE FROM `subscriptions` WHERE `id` = ?";
      }

      @Override
      protected void bind(@NonNull final SupportSQLiteStatement statement,
          @NonNull final SubscriptionEntity entity) {
        if (entity.getId() == null) {
          statement.bindNull(1);
        } else {
          statement.bindString(1, entity.getId());
        }
      }
    };
    this.__updateAdapterOfSubscriptionEntity = new EntityDeletionOrUpdateAdapter<SubscriptionEntity>(__db) {
      @Override
      @NonNull
      protected String createQuery() {
        return "UPDATE OR ABORT `subscriptions` SET `id` = ?,`url` = ?,`title` = ?,`category` = ?,`enabled` = ?,`fetchInterval` = ?,`createdAt` = ?,`updatedAt` = ?,`lastFetchedAt` = ?,`nextFetchAt` = ?,`error` = ?,`httpAuthUsername` = ?,`httpAuthPassword` = ? WHERE `id` = ?";
      }

      @Override
      protected void bind(@NonNull final SupportSQLiteStatement statement,
          @NonNull final SubscriptionEntity entity) {
        if (entity.getId() == null) {
          statement.bindNull(1);
        } else {
          statement.bindString(1, entity.getId());
        }
        if (entity.getUrl() == null) {
          statement.bindNull(2);
        } else {
          statement.bindString(2, entity.getUrl());
        }
        if (entity.getTitle() == null) {
          statement.bindNull(3);
        } else {
          statement.bindString(3, entity.getTitle());
        }
        if (entity.getCategory() == null) {
          statement.bindNull(4);
        } else {
          statement.bindString(4, entity.getCategory());
        }
        final int _tmp = entity.getEnabled() ? 1 : 0;
        statement.bindLong(5, _tmp);
        statement.bindLong(6, entity.getFetchInterval());
        final Long _tmp_1 = __dateConverter.dateToTimestamp(entity.getCreatedAt());
        if (_tmp_1 == null) {
          statement.bindNull(7);
        } else {
          statement.bindLong(7, _tmp_1);
        }
        final Long _tmp_2 = __dateConverter.dateToTimestamp(entity.getUpdatedAt());
        if (_tmp_2 == null) {
          statement.bindNull(8);
        } else {
          statement.bindLong(8, _tmp_2);
        }
        final Long _tmp_3 = __dateConverter.dateToTimestamp(entity.getLastFetchedAt());
        if (_tmp_3 == null) {
          statement.bindNull(9);
        } else {
          statement.bindLong(9, _tmp_3);
        }
        final Long _tmp_4 = __dateConverter.dateToTimestamp(entity.getNextFetchAt());
        if (_tmp_4 == null) {
          statement.bindNull(10);
        } else {
          statement.bindLong(10, _tmp_4);
        }
        if (entity.getError() == null) {
          statement.bindNull(11);
        } else {
          statement.bindString(11, entity.getError());
        }
        if (entity.getHttpAuthUsername() == null) {
          statement.bindNull(12);
        } else {
          statement.bindString(12, entity.getHttpAuthUsername());
        }
        if (entity.getHttpAuthPassword() == null) {
          statement.bindNull(13);
        } else {
          statement.bindString(13, entity.getHttpAuthPassword());
        }
        if (entity.getId() == null) {
          statement.bindNull(14);
        } else {
          statement.bindString(14, entity.getId());
        }
      }
    };
    this.__preparedStmtOfDeleteSubscriptionById = new SharedSQLiteStatement(__db) {
      @Override
      @NonNull
      public String createQuery() {
        final String _query = "DELETE FROM subscriptions WHERE id = ?";
        return _query;
      }
    };
    this.__preparedStmtOfUpdateError = new SharedSQLiteStatement(__db) {
      @Override
      @NonNull
      public String createQuery() {
        final String _query = "UPDATE subscriptions SET error = ? WHERE id = ?";
        return _query;
      }
    };
    this.__preparedStmtOfUpdateLastFetchedAt = new SharedSQLiteStatement(__db) {
      @Override
      @NonNull
      public String createQuery() {
        final String _query = "UPDATE subscriptions SET lastFetchedAt = ?, error = NULL WHERE id = ?";
        return _query;
      }
    };
    this.__preparedStmtOfUpdateNextFetchAt = new SharedSQLiteStatement(__db) {
      @Override
      @NonNull
      public String createQuery() {
        final String _query = "UPDATE subscriptions SET nextFetchAt = ? WHERE id = ?";
        return _query;
      }
    };
  }

  @Override
  public Object insertSubscription(final SubscriptionEntity subscription,
      final Continuation<? super Long> $completion) {
    return CoroutinesRoom.execute(__db, true, new Callable<Long>() {
      @Override
      @NonNull
      public Long call() throws Exception {
        __db.beginTransaction();
        try {
          final Long _result = __insertionAdapterOfSubscriptionEntity.insertAndReturnId(subscription);
          __db.setTransactionSuccessful();
          return _result;
        } finally {
          __db.endTransaction();
        }
      }
    }, $completion);
  }

  @Override
  public Object insertSubscriptions(final List<SubscriptionEntity> subscriptions,
      final Continuation<? super List<Long>> $completion) {
    return CoroutinesRoom.execute(__db, true, new Callable<List<Long>>() {
      @Override
      @NonNull
      public List<Long> call() throws Exception {
        __db.beginTransaction();
        try {
          final List<Long> _result = __insertionAdapterOfSubscriptionEntity.insertAndReturnIdsList(subscriptions);
          __db.setTransactionSuccessful();
          return _result;
        } finally {
          __db.endTransaction();
        }
      }
    }, $completion);
  }

  @Override
  public Object deleteSubscription(final SubscriptionEntity subscription,
      final Continuation<? super Integer> $completion) {
    return CoroutinesRoom.execute(__db, true, new Callable<Integer>() {
      @Override
      @NonNull
      public Integer call() throws Exception {
        int _total = 0;
        __db.beginTransaction();
        try {
          _total += __deletionAdapterOfSubscriptionEntity.handle(subscription);
          __db.setTransactionSuccessful();
          return _total;
        } finally {
          __db.endTransaction();
        }
      }
    }, $completion);
  }

  @Override
  public Object updateSubscription(final SubscriptionEntity subscription,
      final Continuation<? super Integer> $completion) {
    return CoroutinesRoom.execute(__db, true, new Callable<Integer>() {
      @Override
      @NonNull
      public Integer call() throws Exception {
        int _total = 0;
        __db.beginTransaction();
        try {
          _total += __updateAdapterOfSubscriptionEntity.handle(subscription);
          __db.setTransactionSuccessful();
          return _total;
        } finally {
          __db.endTransaction();
        }
      }
    }, $completion);
  }

  @Override
  public Object deleteSubscriptionById(final String id,
      final Continuation<? super Integer> $completion) {
    return CoroutinesRoom.execute(__db, true, new Callable<Integer>() {
      @Override
      @NonNull
      public Integer call() throws Exception {
        final SupportSQLiteStatement _stmt = __preparedStmtOfDeleteSubscriptionById.acquire();
        int _argIndex = 1;
        if (id == null) {
          _stmt.bindNull(_argIndex);
        } else {
          _stmt.bindString(_argIndex, id);
        }
        try {
          __db.beginTransaction();
          try {
            final Integer _result = _stmt.executeUpdateDelete();
            __db.setTransactionSuccessful();
            return _result;
          } finally {
            __db.endTransaction();
          }
        } finally {
          __preparedStmtOfDeleteSubscriptionById.release(_stmt);
        }
      }
    }, $completion);
  }

  @Override
  public Object updateError(final String id, final String error,
      final Continuation<? super Unit> $completion) {
    return CoroutinesRoom.execute(__db, true, new Callable<Unit>() {
      @Override
      @NonNull
      public Unit call() throws Exception {
        final SupportSQLiteStatement _stmt = __preparedStmtOfUpdateError.acquire();
        int _argIndex = 1;
        if (error == null) {
          _stmt.bindNull(_argIndex);
        } else {
          _stmt.bindString(_argIndex, error);
        }
        _argIndex = 2;
        if (id == null) {
          _stmt.bindNull(_argIndex);
        } else {
          _stmt.bindString(_argIndex, id);
        }
        try {
          __db.beginTransaction();
          try {
            _stmt.executeUpdateDelete();
            __db.setTransactionSuccessful();
            return Unit.INSTANCE;
          } finally {
            __db.endTransaction();
          }
        } finally {
          __preparedStmtOfUpdateError.release(_stmt);
        }
      }
    }, $completion);
  }

  @Override
  public Object updateLastFetchedAt(final String id, final Date lastFetchedAt,
      final Continuation<? super Unit> $completion) {
    return CoroutinesRoom.execute(__db, true, new Callable<Unit>() {
      @Override
      @NonNull
      public Unit call() throws Exception {
        final SupportSQLiteStatement _stmt = __preparedStmtOfUpdateLastFetchedAt.acquire();
        int _argIndex = 1;
        final Long _tmp = __dateConverter.dateToTimestamp(lastFetchedAt);
        if (_tmp == null) {
          _stmt.bindNull(_argIndex);
        } else {
          _stmt.bindLong(_argIndex, _tmp);
        }
        _argIndex = 2;
        if (id == null) {
          _stmt.bindNull(_argIndex);
        } else {
          _stmt.bindString(_argIndex, id);
        }
        try {
          __db.beginTransaction();
          try {
            _stmt.executeUpdateDelete();
            __db.setTransactionSuccessful();
            return Unit.INSTANCE;
          } finally {
            __db.endTransaction();
          }
        } finally {
          __preparedStmtOfUpdateLastFetchedAt.release(_stmt);
        }
      }
    }, $completion);
  }

  @Override
  public Object updateNextFetchAt(final String id, final Date nextFetchAt,
      final Continuation<? super Unit> $completion) {
    return CoroutinesRoom.execute(__db, true, new Callable<Unit>() {
      @Override
      @NonNull
      public Unit call() throws Exception {
        final SupportSQLiteStatement _stmt = __preparedStmtOfUpdateNextFetchAt.acquire();
        int _argIndex = 1;
        final Long _tmp = __dateConverter.dateToTimestamp(nextFetchAt);
        if (_tmp == null) {
          _stmt.bindNull(_argIndex);
        } else {
          _stmt.bindLong(_argIndex, _tmp);
        }
        _argIndex = 2;
        if (id == null) {
          _stmt.bindNull(_argIndex);
        } else {
          _stmt.bindString(_argIndex, id);
        }
        try {
          __db.beginTransaction();
          try {
            _stmt.executeUpdateDelete();
            __db.setTransactionSuccessful();
            return Unit.INSTANCE;
          } finally {
            __db.endTransaction();
          }
        } finally {
          __preparedStmtOfUpdateNextFetchAt.release(_stmt);
        }
      }
    }, $completion);
  }

  @Override
  public Flow<List<SubscriptionEntity>> getAllSubscriptions() {
    final String _sql = "SELECT * FROM subscriptions ORDER BY title ASC";
    final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
    return CoroutinesRoom.createFlow(__db, false, new String[] {"subscriptions"}, new Callable<List<SubscriptionEntity>>() {
      @Override
      @NonNull
      public List<SubscriptionEntity> call() throws Exception {
        final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
        try {
          final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
          final int _cursorIndexOfUrl = CursorUtil.getColumnIndexOrThrow(_cursor, "url");
          final int _cursorIndexOfTitle = CursorUtil.getColumnIndexOrThrow(_cursor, "title");
          final int _cursorIndexOfCategory = CursorUtil.getColumnIndexOrThrow(_cursor, "category");
          final int _cursorIndexOfEnabled = CursorUtil.getColumnIndexOrThrow(_cursor, "enabled");
          final int _cursorIndexOfFetchInterval = CursorUtil.getColumnIndexOrThrow(_cursor, "fetchInterval");
          final int _cursorIndexOfCreatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "createdAt");
          final int _cursorIndexOfUpdatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "updatedAt");
          final int _cursorIndexOfLastFetchedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "lastFetchedAt");
          final int _cursorIndexOfNextFetchAt = CursorUtil.getColumnIndexOrThrow(_cursor, "nextFetchAt");
          final int _cursorIndexOfError = CursorUtil.getColumnIndexOrThrow(_cursor, "error");
          final int _cursorIndexOfHttpAuthUsername = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthUsername");
          final int _cursorIndexOfHttpAuthPassword = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthPassword");
          final List<SubscriptionEntity> _result = new ArrayList<SubscriptionEntity>(_cursor.getCount());
          while (_cursor.moveToNext()) {
            final SubscriptionEntity _item;
            final String _tmpId;
            if (_cursor.isNull(_cursorIndexOfId)) {
              _tmpId = null;
            } else {
              _tmpId = _cursor.getString(_cursorIndexOfId);
            }
            final String _tmpUrl;
            if (_cursor.isNull(_cursorIndexOfUrl)) {
              _tmpUrl = null;
            } else {
              _tmpUrl = _cursor.getString(_cursorIndexOfUrl);
            }
            final String _tmpTitle;
            if (_cursor.isNull(_cursorIndexOfTitle)) {
              _tmpTitle = null;
            } else {
              _tmpTitle = _cursor.getString(_cursorIndexOfTitle);
            }
            final String _tmpCategory;
            if (_cursor.isNull(_cursorIndexOfCategory)) {
              _tmpCategory = null;
            } else {
              _tmpCategory = _cursor.getString(_cursorIndexOfCategory);
            }
            final boolean _tmpEnabled;
            final int _tmp;
            _tmp = _cursor.getInt(_cursorIndexOfEnabled);
            _tmpEnabled = _tmp != 0;
            final long _tmpFetchInterval;
            _tmpFetchInterval = _cursor.getLong(_cursorIndexOfFetchInterval);
            final Date _tmpCreatedAt;
            final Long _tmp_1;
            if (_cursor.isNull(_cursorIndexOfCreatedAt)) {
              _tmp_1 = null;
            } else {
              _tmp_1 = _cursor.getLong(_cursorIndexOfCreatedAt);
            }
            _tmpCreatedAt = __dateConverter.fromTimestamp(_tmp_1);
            final Date _tmpUpdatedAt;
            final Long _tmp_2;
            if (_cursor.isNull(_cursorIndexOfUpdatedAt)) {
              _tmp_2 = null;
            } else {
              _tmp_2 = _cursor.getLong(_cursorIndexOfUpdatedAt);
            }
            _tmpUpdatedAt = __dateConverter.fromTimestamp(_tmp_2);
            final Date _tmpLastFetchedAt;
            final Long _tmp_3;
            if (_cursor.isNull(_cursorIndexOfLastFetchedAt)) {
              _tmp_3 = null;
            } else {
              _tmp_3 = _cursor.getLong(_cursorIndexOfLastFetchedAt);
            }
            _tmpLastFetchedAt = __dateConverter.fromTimestamp(_tmp_3);
            final Date _tmpNextFetchAt;
            final Long _tmp_4;
            if (_cursor.isNull(_cursorIndexOfNextFetchAt)) {
              _tmp_4 = null;
            } else {
              _tmp_4 = _cursor.getLong(_cursorIndexOfNextFetchAt);
            }
            _tmpNextFetchAt = __dateConverter.fromTimestamp(_tmp_4);
            final String _tmpError;
            if (_cursor.isNull(_cursorIndexOfError)) {
              _tmpError = null;
            } else {
              _tmpError = _cursor.getString(_cursorIndexOfError);
            }
            final String _tmpHttpAuthUsername;
            if (_cursor.isNull(_cursorIndexOfHttpAuthUsername)) {
              _tmpHttpAuthUsername = null;
            } else {
              _tmpHttpAuthUsername = _cursor.getString(_cursorIndexOfHttpAuthUsername);
            }
            final String _tmpHttpAuthPassword;
            if (_cursor.isNull(_cursorIndexOfHttpAuthPassword)) {
              _tmpHttpAuthPassword = null;
            } else {
              _tmpHttpAuthPassword = _cursor.getString(_cursorIndexOfHttpAuthPassword);
            }
            _item = new SubscriptionEntity(_tmpId,_tmpUrl,_tmpTitle,_tmpCategory,_tmpEnabled,_tmpFetchInterval,_tmpCreatedAt,_tmpUpdatedAt,_tmpLastFetchedAt,_tmpNextFetchAt,_tmpError,_tmpHttpAuthUsername,_tmpHttpAuthPassword);
            _result.add(_item);
          }
          return _result;
        } finally {
          _cursor.close();
        }
      }

      @Override
      protected void finalize() {
        _statement.release();
      }
    });
  }

  @Override
  public Object getSubscriptionById(final String id,
      final Continuation<? super SubscriptionEntity> $completion) {
    final String _sql = "SELECT * FROM subscriptions WHERE id = ?";
    final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
    int _argIndex = 1;
    if (id == null) {
      _statement.bindNull(_argIndex);
    } else {
      _statement.bindString(_argIndex, id);
    }
    final CancellationSignal _cancellationSignal = DBUtil.createCancellationSignal();
    return CoroutinesRoom.execute(__db, false, _cancellationSignal, new Callable<SubscriptionEntity>() {
      @Override
      @Nullable
      public SubscriptionEntity call() throws Exception {
        final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
        try {
          final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
          final int _cursorIndexOfUrl = CursorUtil.getColumnIndexOrThrow(_cursor, "url");
          final int _cursorIndexOfTitle = CursorUtil.getColumnIndexOrThrow(_cursor, "title");
          final int _cursorIndexOfCategory = CursorUtil.getColumnIndexOrThrow(_cursor, "category");
          final int _cursorIndexOfEnabled = CursorUtil.getColumnIndexOrThrow(_cursor, "enabled");
          final int _cursorIndexOfFetchInterval = CursorUtil.getColumnIndexOrThrow(_cursor, "fetchInterval");
          final int _cursorIndexOfCreatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "createdAt");
          final int _cursorIndexOfUpdatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "updatedAt");
          final int _cursorIndexOfLastFetchedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "lastFetchedAt");
          final int _cursorIndexOfNextFetchAt = CursorUtil.getColumnIndexOrThrow(_cursor, "nextFetchAt");
          final int _cursorIndexOfError = CursorUtil.getColumnIndexOrThrow(_cursor, "error");
          final int _cursorIndexOfHttpAuthUsername = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthUsername");
          final int _cursorIndexOfHttpAuthPassword = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthPassword");
          final SubscriptionEntity _result;
          if (_cursor.moveToFirst()) {
            final String _tmpId;
            if (_cursor.isNull(_cursorIndexOfId)) {
              _tmpId = null;
            } else {
              _tmpId = _cursor.getString(_cursorIndexOfId);
            }
            final String _tmpUrl;
            if (_cursor.isNull(_cursorIndexOfUrl)) {
              _tmpUrl = null;
            } else {
              _tmpUrl = _cursor.getString(_cursorIndexOfUrl);
            }
            final String _tmpTitle;
            if (_cursor.isNull(_cursorIndexOfTitle)) {
              _tmpTitle = null;
            } else {
              _tmpTitle = _cursor.getString(_cursorIndexOfTitle);
            }
            final String _tmpCategory;
            if (_cursor.isNull(_cursorIndexOfCategory)) {
              _tmpCategory = null;
            } else {
              _tmpCategory = _cursor.getString(_cursorIndexOfCategory);
            }
            final boolean _tmpEnabled;
            final int _tmp;
            _tmp = _cursor.getInt(_cursorIndexOfEnabled);
            _tmpEnabled = _tmp != 0;
            final long _tmpFetchInterval;
            _tmpFetchInterval = _cursor.getLong(_cursorIndexOfFetchInterval);
            final Date _tmpCreatedAt;
            final Long _tmp_1;
            if (_cursor.isNull(_cursorIndexOfCreatedAt)) {
              _tmp_1 = null;
            } else {
              _tmp_1 = _cursor.getLong(_cursorIndexOfCreatedAt);
            }
            _tmpCreatedAt = __dateConverter.fromTimestamp(_tmp_1);
            final Date _tmpUpdatedAt;
            final Long _tmp_2;
            if (_cursor.isNull(_cursorIndexOfUpdatedAt)) {
              _tmp_2 = null;
            } else {
              _tmp_2 = _cursor.getLong(_cursorIndexOfUpdatedAt);
            }
            _tmpUpdatedAt = __dateConverter.fromTimestamp(_tmp_2);
            final Date _tmpLastFetchedAt;
            final Long _tmp_3;
            if (_cursor.isNull(_cursorIndexOfLastFetchedAt)) {
              _tmp_3 = null;
            } else {
              _tmp_3 = _cursor.getLong(_cursorIndexOfLastFetchedAt);
            }
            _tmpLastFetchedAt = __dateConverter.fromTimestamp(_tmp_3);
            final Date _tmpNextFetchAt;
            final Long _tmp_4;
            if (_cursor.isNull(_cursorIndexOfNextFetchAt)) {
              _tmp_4 = null;
            } else {
              _tmp_4 = _cursor.getLong(_cursorIndexOfNextFetchAt);
            }
            _tmpNextFetchAt = __dateConverter.fromTimestamp(_tmp_4);
            final String _tmpError;
            if (_cursor.isNull(_cursorIndexOfError)) {
              _tmpError = null;
            } else {
              _tmpError = _cursor.getString(_cursorIndexOfError);
            }
            final String _tmpHttpAuthUsername;
            if (_cursor.isNull(_cursorIndexOfHttpAuthUsername)) {
              _tmpHttpAuthUsername = null;
            } else {
              _tmpHttpAuthUsername = _cursor.getString(_cursorIndexOfHttpAuthUsername);
            }
            final String _tmpHttpAuthPassword;
            if (_cursor.isNull(_cursorIndexOfHttpAuthPassword)) {
              _tmpHttpAuthPassword = null;
            } else {
              _tmpHttpAuthPassword = _cursor.getString(_cursorIndexOfHttpAuthPassword);
            }
            _result = new SubscriptionEntity(_tmpId,_tmpUrl,_tmpTitle,_tmpCategory,_tmpEnabled,_tmpFetchInterval,_tmpCreatedAt,_tmpUpdatedAt,_tmpLastFetchedAt,_tmpNextFetchAt,_tmpError,_tmpHttpAuthUsername,_tmpHttpAuthPassword);
          } else {
            _result = null;
          }
          return _result;
        } finally {
          _cursor.close();
          _statement.release();
        }
      }
    }, $completion);
  }

  @Override
  public Object getSubscriptionByUrl(final String url,
      final Continuation<? super SubscriptionEntity> $completion) {
    final String _sql = "SELECT * FROM subscriptions WHERE url = ?";
    final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
    int _argIndex = 1;
    if (url == null) {
      _statement.bindNull(_argIndex);
    } else {
      _statement.bindString(_argIndex, url);
    }
    final CancellationSignal _cancellationSignal = DBUtil.createCancellationSignal();
    return CoroutinesRoom.execute(__db, false, _cancellationSignal, new Callable<SubscriptionEntity>() {
      @Override
      @Nullable
      public SubscriptionEntity call() throws Exception {
        final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
        try {
          final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
          final int _cursorIndexOfUrl = CursorUtil.getColumnIndexOrThrow(_cursor, "url");
          final int _cursorIndexOfTitle = CursorUtil.getColumnIndexOrThrow(_cursor, "title");
          final int _cursorIndexOfCategory = CursorUtil.getColumnIndexOrThrow(_cursor, "category");
          final int _cursorIndexOfEnabled = CursorUtil.getColumnIndexOrThrow(_cursor, "enabled");
          final int _cursorIndexOfFetchInterval = CursorUtil.getColumnIndexOrThrow(_cursor, "fetchInterval");
          final int _cursorIndexOfCreatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "createdAt");
          final int _cursorIndexOfUpdatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "updatedAt");
          final int _cursorIndexOfLastFetchedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "lastFetchedAt");
          final int _cursorIndexOfNextFetchAt = CursorUtil.getColumnIndexOrThrow(_cursor, "nextFetchAt");
          final int _cursorIndexOfError = CursorUtil.getColumnIndexOrThrow(_cursor, "error");
          final int _cursorIndexOfHttpAuthUsername = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthUsername");
          final int _cursorIndexOfHttpAuthPassword = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthPassword");
          final SubscriptionEntity _result;
          if (_cursor.moveToFirst()) {
            final String _tmpId;
            if (_cursor.isNull(_cursorIndexOfId)) {
              _tmpId = null;
            } else {
              _tmpId = _cursor.getString(_cursorIndexOfId);
            }
            final String _tmpUrl;
            if (_cursor.isNull(_cursorIndexOfUrl)) {
              _tmpUrl = null;
            } else {
              _tmpUrl = _cursor.getString(_cursorIndexOfUrl);
            }
            final String _tmpTitle;
            if (_cursor.isNull(_cursorIndexOfTitle)) {
              _tmpTitle = null;
            } else {
              _tmpTitle = _cursor.getString(_cursorIndexOfTitle);
            }
            final String _tmpCategory;
            if (_cursor.isNull(_cursorIndexOfCategory)) {
              _tmpCategory = null;
            } else {
              _tmpCategory = _cursor.getString(_cursorIndexOfCategory);
            }
            final boolean _tmpEnabled;
            final int _tmp;
            _tmp = _cursor.getInt(_cursorIndexOfEnabled);
            _tmpEnabled = _tmp != 0;
            final long _tmpFetchInterval;
            _tmpFetchInterval = _cursor.getLong(_cursorIndexOfFetchInterval);
            final Date _tmpCreatedAt;
            final Long _tmp_1;
            if (_cursor.isNull(_cursorIndexOfCreatedAt)) {
              _tmp_1 = null;
            } else {
              _tmp_1 = _cursor.getLong(_cursorIndexOfCreatedAt);
            }
            _tmpCreatedAt = __dateConverter.fromTimestamp(_tmp_1);
            final Date _tmpUpdatedAt;
            final Long _tmp_2;
            if (_cursor.isNull(_cursorIndexOfUpdatedAt)) {
              _tmp_2 = null;
            } else {
              _tmp_2 = _cursor.getLong(_cursorIndexOfUpdatedAt);
            }
            _tmpUpdatedAt = __dateConverter.fromTimestamp(_tmp_2);
            final Date _tmpLastFetchedAt;
            final Long _tmp_3;
            if (_cursor.isNull(_cursorIndexOfLastFetchedAt)) {
              _tmp_3 = null;
            } else {
              _tmp_3 = _cursor.getLong(_cursorIndexOfLastFetchedAt);
            }
            _tmpLastFetchedAt = __dateConverter.fromTimestamp(_tmp_3);
            final Date _tmpNextFetchAt;
            final Long _tmp_4;
            if (_cursor.isNull(_cursorIndexOfNextFetchAt)) {
              _tmp_4 = null;
            } else {
              _tmp_4 = _cursor.getLong(_cursorIndexOfNextFetchAt);
            }
            _tmpNextFetchAt = __dateConverter.fromTimestamp(_tmp_4);
            final String _tmpError;
            if (_cursor.isNull(_cursorIndexOfError)) {
              _tmpError = null;
            } else {
              _tmpError = _cursor.getString(_cursorIndexOfError);
            }
            final String _tmpHttpAuthUsername;
            if (_cursor.isNull(_cursorIndexOfHttpAuthUsername)) {
              _tmpHttpAuthUsername = null;
            } else {
              _tmpHttpAuthUsername = _cursor.getString(_cursorIndexOfHttpAuthUsername);
            }
            final String _tmpHttpAuthPassword;
            if (_cursor.isNull(_cursorIndexOfHttpAuthPassword)) {
              _tmpHttpAuthPassword = null;
            } else {
              _tmpHttpAuthPassword = _cursor.getString(_cursorIndexOfHttpAuthPassword);
            }
            _result = new SubscriptionEntity(_tmpId,_tmpUrl,_tmpTitle,_tmpCategory,_tmpEnabled,_tmpFetchInterval,_tmpCreatedAt,_tmpUpdatedAt,_tmpLastFetchedAt,_tmpNextFetchAt,_tmpError,_tmpHttpAuthUsername,_tmpHttpAuthPassword);
          } else {
            _result = null;
          }
          return _result;
        } finally {
          _cursor.close();
          _statement.release();
        }
      }
    }, $completion);
  }

  @Override
  public Flow<List<SubscriptionEntity>> getEnabledSubscriptions() {
    final String _sql = "SELECT * FROM subscriptions WHERE enabled = 1 ORDER BY title ASC";
    final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
    return CoroutinesRoom.createFlow(__db, false, new String[] {"subscriptions"}, new Callable<List<SubscriptionEntity>>() {
      @Override
      @NonNull
      public List<SubscriptionEntity> call() throws Exception {
        final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
        try {
          final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
          final int _cursorIndexOfUrl = CursorUtil.getColumnIndexOrThrow(_cursor, "url");
          final int _cursorIndexOfTitle = CursorUtil.getColumnIndexOrThrow(_cursor, "title");
          final int _cursorIndexOfCategory = CursorUtil.getColumnIndexOrThrow(_cursor, "category");
          final int _cursorIndexOfEnabled = CursorUtil.getColumnIndexOrThrow(_cursor, "enabled");
          final int _cursorIndexOfFetchInterval = CursorUtil.getColumnIndexOrThrow(_cursor, "fetchInterval");
          final int _cursorIndexOfCreatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "createdAt");
          final int _cursorIndexOfUpdatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "updatedAt");
          final int _cursorIndexOfLastFetchedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "lastFetchedAt");
          final int _cursorIndexOfNextFetchAt = CursorUtil.getColumnIndexOrThrow(_cursor, "nextFetchAt");
          final int _cursorIndexOfError = CursorUtil.getColumnIndexOrThrow(_cursor, "error");
          final int _cursorIndexOfHttpAuthUsername = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthUsername");
          final int _cursorIndexOfHttpAuthPassword = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthPassword");
          final List<SubscriptionEntity> _result = new ArrayList<SubscriptionEntity>(_cursor.getCount());
          while (_cursor.moveToNext()) {
            final SubscriptionEntity _item;
            final String _tmpId;
            if (_cursor.isNull(_cursorIndexOfId)) {
              _tmpId = null;
            } else {
              _tmpId = _cursor.getString(_cursorIndexOfId);
            }
            final String _tmpUrl;
            if (_cursor.isNull(_cursorIndexOfUrl)) {
              _tmpUrl = null;
            } else {
              _tmpUrl = _cursor.getString(_cursorIndexOfUrl);
            }
            final String _tmpTitle;
            if (_cursor.isNull(_cursorIndexOfTitle)) {
              _tmpTitle = null;
            } else {
              _tmpTitle = _cursor.getString(_cursorIndexOfTitle);
            }
            final String _tmpCategory;
            if (_cursor.isNull(_cursorIndexOfCategory)) {
              _tmpCategory = null;
            } else {
              _tmpCategory = _cursor.getString(_cursorIndexOfCategory);
            }
            final boolean _tmpEnabled;
            final int _tmp;
            _tmp = _cursor.getInt(_cursorIndexOfEnabled);
            _tmpEnabled = _tmp != 0;
            final long _tmpFetchInterval;
            _tmpFetchInterval = _cursor.getLong(_cursorIndexOfFetchInterval);
            final Date _tmpCreatedAt;
            final Long _tmp_1;
            if (_cursor.isNull(_cursorIndexOfCreatedAt)) {
              _tmp_1 = null;
            } else {
              _tmp_1 = _cursor.getLong(_cursorIndexOfCreatedAt);
            }
            _tmpCreatedAt = __dateConverter.fromTimestamp(_tmp_1);
            final Date _tmpUpdatedAt;
            final Long _tmp_2;
            if (_cursor.isNull(_cursorIndexOfUpdatedAt)) {
              _tmp_2 = null;
            } else {
              _tmp_2 = _cursor.getLong(_cursorIndexOfUpdatedAt);
            }
            _tmpUpdatedAt = __dateConverter.fromTimestamp(_tmp_2);
            final Date _tmpLastFetchedAt;
            final Long _tmp_3;
            if (_cursor.isNull(_cursorIndexOfLastFetchedAt)) {
              _tmp_3 = null;
            } else {
              _tmp_3 = _cursor.getLong(_cursorIndexOfLastFetchedAt);
            }
            _tmpLastFetchedAt = __dateConverter.fromTimestamp(_tmp_3);
            final Date _tmpNextFetchAt;
            final Long _tmp_4;
            if (_cursor.isNull(_cursorIndexOfNextFetchAt)) {
              _tmp_4 = null;
            } else {
              _tmp_4 = _cursor.getLong(_cursorIndexOfNextFetchAt);
            }
            _tmpNextFetchAt = __dateConverter.fromTimestamp(_tmp_4);
            final String _tmpError;
            if (_cursor.isNull(_cursorIndexOfError)) {
              _tmpError = null;
            } else {
              _tmpError = _cursor.getString(_cursorIndexOfError);
            }
            final String _tmpHttpAuthUsername;
            if (_cursor.isNull(_cursorIndexOfHttpAuthUsername)) {
              _tmpHttpAuthUsername = null;
            } else {
              _tmpHttpAuthUsername = _cursor.getString(_cursorIndexOfHttpAuthUsername);
            }
            final String _tmpHttpAuthPassword;
            if (_cursor.isNull(_cursorIndexOfHttpAuthPassword)) {
              _tmpHttpAuthPassword = null;
            } else {
              _tmpHttpAuthPassword = _cursor.getString(_cursorIndexOfHttpAuthPassword);
            }
            _item = new SubscriptionEntity(_tmpId,_tmpUrl,_tmpTitle,_tmpCategory,_tmpEnabled,_tmpFetchInterval,_tmpCreatedAt,_tmpUpdatedAt,_tmpLastFetchedAt,_tmpNextFetchAt,_tmpError,_tmpHttpAuthUsername,_tmpHttpAuthPassword);
            _result.add(_item);
          }
          return _result;
        } finally {
          _cursor.close();
        }
      }

      @Override
      protected void finalize() {
        _statement.release();
      }
    });
  }

  @Override
  public Flow<List<SubscriptionEntity>> getSubscriptionsByCategory(final String category) {
    final String _sql = "SELECT * FROM subscriptions WHERE category = ? ORDER BY title ASC";
    final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
    int _argIndex = 1;
    if (category == null) {
      _statement.bindNull(_argIndex);
    } else {
      _statement.bindString(_argIndex, category);
    }
    return CoroutinesRoom.createFlow(__db, false, new String[] {"subscriptions"}, new Callable<List<SubscriptionEntity>>() {
      @Override
      @NonNull
      public List<SubscriptionEntity> call() throws Exception {
        final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
        try {
          final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
          final int _cursorIndexOfUrl = CursorUtil.getColumnIndexOrThrow(_cursor, "url");
          final int _cursorIndexOfTitle = CursorUtil.getColumnIndexOrThrow(_cursor, "title");
          final int _cursorIndexOfCategory = CursorUtil.getColumnIndexOrThrow(_cursor, "category");
          final int _cursorIndexOfEnabled = CursorUtil.getColumnIndexOrThrow(_cursor, "enabled");
          final int _cursorIndexOfFetchInterval = CursorUtil.getColumnIndexOrThrow(_cursor, "fetchInterval");
          final int _cursorIndexOfCreatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "createdAt");
          final int _cursorIndexOfUpdatedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "updatedAt");
          final int _cursorIndexOfLastFetchedAt = CursorUtil.getColumnIndexOrThrow(_cursor, "lastFetchedAt");
          final int _cursorIndexOfNextFetchAt = CursorUtil.getColumnIndexOrThrow(_cursor, "nextFetchAt");
          final int _cursorIndexOfError = CursorUtil.getColumnIndexOrThrow(_cursor, "error");
          final int _cursorIndexOfHttpAuthUsername = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthUsername");
          final int _cursorIndexOfHttpAuthPassword = CursorUtil.getColumnIndexOrThrow(_cursor, "httpAuthPassword");
          final List<SubscriptionEntity> _result = new ArrayList<SubscriptionEntity>(_cursor.getCount());
          while (_cursor.moveToNext()) {
            final SubscriptionEntity _item;
            final String _tmpId;
            if (_cursor.isNull(_cursorIndexOfId)) {
              _tmpId = null;
            } else {
              _tmpId = _cursor.getString(_cursorIndexOfId);
            }
            final String _tmpUrl;
            if (_cursor.isNull(_cursorIndexOfUrl)) {
              _tmpUrl = null;
            } else {
              _tmpUrl = _cursor.getString(_cursorIndexOfUrl);
            }
            final String _tmpTitle;
            if (_cursor.isNull(_cursorIndexOfTitle)) {
              _tmpTitle = null;
            } else {
              _tmpTitle = _cursor.getString(_cursorIndexOfTitle);
            }
            final String _tmpCategory;
            if (_cursor.isNull(_cursorIndexOfCategory)) {
              _tmpCategory = null;
            } else {
              _tmpCategory = _cursor.getString(_cursorIndexOfCategory);
            }
            final boolean _tmpEnabled;
            final int _tmp;
            _tmp = _cursor.getInt(_cursorIndexOfEnabled);
            _tmpEnabled = _tmp != 0;
            final long _tmpFetchInterval;
            _tmpFetchInterval = _cursor.getLong(_cursorIndexOfFetchInterval);
            final Date _tmpCreatedAt;
            final Long _tmp_1;
            if (_cursor.isNull(_cursorIndexOfCreatedAt)) {
              _tmp_1 = null;
            } else {
              _tmp_1 = _cursor.getLong(_cursorIndexOfCreatedAt);
            }
            _tmpCreatedAt = __dateConverter.fromTimestamp(_tmp_1);
            final Date _tmpUpdatedAt;
            final Long _tmp_2;
            if (_cursor.isNull(_cursorIndexOfUpdatedAt)) {
              _tmp_2 = null;
            } else {
              _tmp_2 = _cursor.getLong(_cursorIndexOfUpdatedAt);
            }
            _tmpUpdatedAt = __dateConverter.fromTimestamp(_tmp_2);
            final Date _tmpLastFetchedAt;
            final Long _tmp_3;
            if (_cursor.isNull(_cursorIndexOfLastFetchedAt)) {
              _tmp_3 = null;
            } else {
              _tmp_3 = _cursor.getLong(_cursorIndexOfLastFetchedAt);
            }
            _tmpLastFetchedAt = __dateConverter.fromTimestamp(_tmp_3);
            final Date _tmpNextFetchAt;
            final Long _tmp_4;
            if (_cursor.isNull(_cursorIndexOfNextFetchAt)) {
              _tmp_4 = null;
            } else {
              _tmp_4 = _cursor.getLong(_cursorIndexOfNextFetchAt);
            }
            _tmpNextFetchAt = __dateConverter.fromTimestamp(_tmp_4);
            final String _tmpError;
            if (_cursor.isNull(_cursorIndexOfError)) {
              _tmpError = null;
            } else {
              _tmpError = _cursor.getString(_cursorIndexOfError);
            }
            final String _tmpHttpAuthUsername;
            if (_cursor.isNull(_cursorIndexOfHttpAuthUsername)) {
              _tmpHttpAuthUsername = null;
            } else {
              _tmpHttpAuthUsername = _cursor.getString(_cursorIndexOfHttpAuthUsername);
            }
            final String _tmpHttpAuthPassword;
            if (_cursor.isNull(_cursorIndexOfHttpAuthPassword)) {
              _tmpHttpAuthPassword = null;
            } else {
              _tmpHttpAuthPassword = _cursor.getString(_cursorIndexOfHttpAuthPassword);
            }
            _item = new SubscriptionEntity(_tmpId,_tmpUrl,_tmpTitle,_tmpCategory,_tmpEnabled,_tmpFetchInterval,_tmpCreatedAt,_tmpUpdatedAt,_tmpLastFetchedAt,_tmpNextFetchAt,_tmpError,_tmpHttpAuthUsername,_tmpHttpAuthPassword);
            _result.add(_item);
          }
          return _result;
        } finally {
          _cursor.close();
        }
      }

      @Override
      protected void finalize() {
        _statement.release();
      }
    });
  }

  @Override
  public Flow<Integer> getSubscriptionCount() {
    final String _sql = "SELECT COUNT(*) FROM subscriptions";
    final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
    return CoroutinesRoom.createFlow(__db, false, new String[] {"subscriptions"}, new Callable<Integer>() {
      @Override
      @NonNull
      public Integer call() throws Exception {
        final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
        try {
          final Integer _result;
          if (_cursor.moveToFirst()) {
            final Integer _tmp;
            if (_cursor.isNull(0)) {
              _tmp = null;
            } else {
              _tmp = _cursor.getInt(0);
            }
            _result = _tmp;
          } else {
            _result = null;
          }
          return _result;
        } finally {
          _cursor.close();
        }
      }

      @Override
      protected void finalize() {
        _statement.release();
      }
    });
  }

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