package hanson.xyz.vpnhotspotmod.room;

import androidx.annotation.NonNull;
import androidx.room.DatabaseConfiguration;
import androidx.room.InvalidationTracker;
import androidx.room.RoomDatabase;
import androidx.room.RoomOpenHelper;
import androidx.room.migration.AutoMigrationSpec;
import androidx.room.migration.Migration;
import androidx.room.util.DBUtil;
import androidx.room.util.TableInfo;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import java.lang.Class;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.processing.Generated;

@Generated("androidx.room.RoomProcessor")
@SuppressWarnings({"unchecked", "deprecation"})
public final class AppDatabase_Impl extends AppDatabase {
  private volatile ClientRecord.Dao _clientRecord;

  private volatile TrafficRecord.Dao _trafficRecord;

  @Override
  @NonNull
  protected SupportSQLiteOpenHelper createOpenHelper(@NonNull final DatabaseConfiguration config) {
    final SupportSQLiteOpenHelper.Callback _openCallback = new RoomOpenHelper(config, new RoomOpenHelper.Delegate(2) {
      @Override
      public void createAllTables(@NonNull final SupportSQLiteDatabase db) {
        db.execSQL("CREATE TABLE IF NOT EXISTS `ClientRecord` (`mac` INTEGER NOT NULL, `nickname` BLOB NOT NULL, `blocked` INTEGER NOT NULL, `macLookupPending` INTEGER NOT NULL, PRIMARY KEY(`mac`))");
        db.execSQL("CREATE TABLE IF NOT EXISTS `TrafficRecord` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `timestamp` INTEGER NOT NULL, `mac` INTEGER NOT NULL, `ip` BLOB NOT NULL, `upstream` TEXT, `downstream` TEXT NOT NULL, `sentPackets` INTEGER NOT NULL, `sentBytes` INTEGER NOT NULL, `receivedPackets` INTEGER NOT NULL, `receivedBytes` INTEGER NOT NULL, `previousId` INTEGER, FOREIGN KEY(`previousId`) REFERENCES `TrafficRecord`(`id`) ON UPDATE RESTRICT ON DELETE CASCADE )");
        db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS `index_TrafficRecord_previousId` ON `TrafficRecord` (`previousId`)");
        db.execSQL("CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)");
        db.execSQL("INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '92a6c0406ed7265dbd98eb3c24095651')");
      }

      @Override
      public void dropAllTables(@NonNull final SupportSQLiteDatabase db) {
        db.execSQL("DROP TABLE IF EXISTS `ClientRecord`");
        db.execSQL("DROP TABLE IF EXISTS `TrafficRecord`");
        final List<? extends RoomDatabase.Callback> _callbacks = mCallbacks;
        if (_callbacks != null) {
          for (RoomDatabase.Callback _callback : _callbacks) {
            _callback.onDestructiveMigration(db);
          }
        }
      }

      @Override
      public void onCreate(@NonNull final SupportSQLiteDatabase db) {
        final List<? extends RoomDatabase.Callback> _callbacks = mCallbacks;
        if (_callbacks != null) {
          for (RoomDatabase.Callback _callback : _callbacks) {
            _callback.onCreate(db);
          }
        }
      }

      @Override
      public void onOpen(@NonNull final SupportSQLiteDatabase db) {
        mDatabase = db;
        db.execSQL("PRAGMA foreign_keys = ON");
        internalInitInvalidationTracker(db);
        final List<? extends RoomDatabase.Callback> _callbacks = mCallbacks;
        if (_callbacks != null) {
          for (RoomDatabase.Callback _callback : _callbacks) {
            _callback.onOpen(db);
          }
        }
      }

      @Override
      public void onPreMigrate(@NonNull final SupportSQLiteDatabase db) {
        DBUtil.dropFtsSyncTriggers(db);
      }

      @Override
      public void onPostMigrate(@NonNull final SupportSQLiteDatabase db) {
      }

      @Override
      @NonNull
      public RoomOpenHelper.ValidationResult onValidateSchema(
          @NonNull final SupportSQLiteDatabase db) {
        final HashMap<String, TableInfo.Column> _columnsClientRecord = new HashMap<String, TableInfo.Column>(4);
        _columnsClientRecord.put("mac", new TableInfo.Column("mac", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsClientRecord.put("nickname", new TableInfo.Column("nickname", "BLOB", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsClientRecord.put("blocked", new TableInfo.Column("blocked", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsClientRecord.put("macLookupPending", new TableInfo.Column("macLookupPending", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        final HashSet<TableInfo.ForeignKey> _foreignKeysClientRecord = new HashSet<TableInfo.ForeignKey>(0);
        final HashSet<TableInfo.Index> _indicesClientRecord = new HashSet<TableInfo.Index>(0);
        final TableInfo _infoClientRecord = new TableInfo("ClientRecord", _columnsClientRecord, _foreignKeysClientRecord, _indicesClientRecord);
        final TableInfo _existingClientRecord = TableInfo.read(db, "ClientRecord");
        if (!_infoClientRecord.equals(_existingClientRecord)) {
          return new RoomOpenHelper.ValidationResult(false, "ClientRecord(hanson.xyz.vpnhotspotmod.room.ClientRecord).\n"
                  + " Expected:\n" + _infoClientRecord + "\n"
                  + " Found:\n" + _existingClientRecord);
        }
        final HashMap<String, TableInfo.Column> _columnsTrafficRecord = new HashMap<String, TableInfo.Column>(11);
        _columnsTrafficRecord.put("id", new TableInfo.Column("id", "INTEGER", false, 1, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("timestamp", new TableInfo.Column("timestamp", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("mac", new TableInfo.Column("mac", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("ip", new TableInfo.Column("ip", "BLOB", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("upstream", new TableInfo.Column("upstream", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("downstream", new TableInfo.Column("downstream", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("sentPackets", new TableInfo.Column("sentPackets", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("sentBytes", new TableInfo.Column("sentBytes", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("receivedPackets", new TableInfo.Column("receivedPackets", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("receivedBytes", new TableInfo.Column("receivedBytes", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsTrafficRecord.put("previousId", new TableInfo.Column("previousId", "INTEGER", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
        final HashSet<TableInfo.ForeignKey> _foreignKeysTrafficRecord = new HashSet<TableInfo.ForeignKey>(1);
        _foreignKeysTrafficRecord.add(new TableInfo.ForeignKey("TrafficRecord", "CASCADE", "RESTRICT", Arrays.asList("previousId"), Arrays.asList("id")));
        final HashSet<TableInfo.Index> _indicesTrafficRecord = new HashSet<TableInfo.Index>(1);
        _indicesTrafficRecord.add(new TableInfo.Index("index_TrafficRecord_previousId", true, Arrays.asList("previousId"), Arrays.asList("ASC")));
        final TableInfo _infoTrafficRecord = new TableInfo("TrafficRecord", _columnsTrafficRecord, _foreignKeysTrafficRecord, _indicesTrafficRecord);
        final TableInfo _existingTrafficRecord = TableInfo.read(db, "TrafficRecord");
        if (!_infoTrafficRecord.equals(_existingTrafficRecord)) {
          return new RoomOpenHelper.ValidationResult(false, "TrafficRecord(hanson.xyz.vpnhotspotmod.room.TrafficRecord).\n"
                  + " Expected:\n" + _infoTrafficRecord + "\n"
                  + " Found:\n" + _existingTrafficRecord);
        }
        return new RoomOpenHelper.ValidationResult(true, null);
      }
    }, "92a6c0406ed7265dbd98eb3c24095651", "1f08a76d9f7ed5013d3879caeddd243c");
    final SupportSQLiteOpenHelper.Configuration _sqliteConfig = SupportSQLiteOpenHelper.Configuration.builder(config.context).name(config.name).callback(_openCallback).build();
    final SupportSQLiteOpenHelper _helper = config.sqliteOpenHelperFactory.create(_sqliteConfig);
    return _helper;
  }

  @Override
  @NonNull
  protected InvalidationTracker createInvalidationTracker() {
    final HashMap<String, String> _shadowTablesMap = new HashMap<String, String>(0);
    final HashMap<String, Set<String>> _viewTables = new HashMap<String, Set<String>>(0);
    return new InvalidationTracker(this, _shadowTablesMap, _viewTables, "ClientRecord","TrafficRecord");
  }

  @Override
  public void clearAllTables() {
    super.assertNotMainThread();
    final SupportSQLiteDatabase _db = super.getOpenHelper().getWritableDatabase();
    final boolean _supportsDeferForeignKeys = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP;
    try {
      if (!_supportsDeferForeignKeys) {
        _db.execSQL("PRAGMA foreign_keys = FALSE");
      }
      super.beginTransaction();
      if (_supportsDeferForeignKeys) {
        _db.execSQL("PRAGMA defer_foreign_keys = TRUE");
      }
      _db.execSQL("DELETE FROM `ClientRecord`");
      _db.execSQL("DELETE FROM `TrafficRecord`");
      super.setTransactionSuccessful();
    } finally {
      super.endTransaction();
      if (!_supportsDeferForeignKeys) {
        _db.execSQL("PRAGMA foreign_keys = TRUE");
      }
      _db.query("PRAGMA wal_checkpoint(FULL)").close();
      if (!_db.inTransaction()) {
        _db.execSQL("VACUUM");
      }
    }
  }

  @Override
  @NonNull
  protected Map<Class<?>, List<Class<?>>> getRequiredTypeConverters() {
    final HashMap<Class<?>, List<Class<?>>> _typeConvertersMap = new HashMap<Class<?>, List<Class<?>>>();
    _typeConvertersMap.put(ClientRecord.Dao.class, ClientRecord_Dao_Impl.getRequiredConverters());
    _typeConvertersMap.put(TrafficRecord.Dao.class, TrafficRecord_Dao_Impl.getRequiredConverters());
    return _typeConvertersMap;
  }

  @Override
  @NonNull
  public Set<Class<? extends AutoMigrationSpec>> getRequiredAutoMigrationSpecs() {
    final HashSet<Class<? extends AutoMigrationSpec>> _autoMigrationSpecsSet = new HashSet<Class<? extends AutoMigrationSpec>>();
    return _autoMigrationSpecsSet;
  }

  @Override
  @NonNull
  public List<Migration> getAutoMigrations(
      @NonNull final Map<Class<? extends AutoMigrationSpec>, AutoMigrationSpec> autoMigrationSpecs) {
    final List<Migration> _autoMigrations = new ArrayList<Migration>();
    return _autoMigrations;
  }

  @Override
  public ClientRecord.Dao getClientRecordDao() {
    if (_clientRecord != null) {
      return _clientRecord;
    } else {
      synchronized(this) {
        if(_clientRecord == null) {
          _clientRecord = new ClientRecord_Dao_Impl(this);
        }
        return _clientRecord;
      }
    }
  }

  @Override
  public TrafficRecord.Dao getTrafficRecordDao() {
    if (_trafficRecord != null) {
      return _trafficRecord;
    } else {
      synchronized(this) {
        if(_trafficRecord == null) {
          _trafficRecord = new TrafficRecord_Dao_Impl(this);
        }
        return _trafficRecord;
      }
    }
  }
}
