package com.parkplants.data.db;

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 com.parkplants.data.db.dao.CachedNurseryDao;
import com.parkplants.data.db.dao.CachedNurseryDao_Impl;
import com.parkplants.data.db.dao.CachedPlantTypeDao;
import com.parkplants.data.db.dao.CachedPlantTypeDao_Impl;
import com.parkplants.data.db.dao.PendingPlantDao;
import com.parkplants.data.db.dao.PendingPlantDao_Impl;
import com.parkplants.data.db.dao.PlantTypeColorDao;
import com.parkplants.data.db.dao.PlantTypeColorDao_Impl;
import java.lang.Class;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.ArrayList;
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 PendingPlantDao _pendingPlantDao;

  private volatile CachedPlantTypeDao _cachedPlantTypeDao;

  private volatile CachedNurseryDao _cachedNurseryDao;

  private volatile PlantTypeColorDao _plantTypeColorDao;

  @Override
  @NonNull
  protected SupportSQLiteOpenHelper createOpenHelper(@NonNull final DatabaseConfiguration config) {
    final SupportSQLiteOpenHelper.Callback _openCallback = new RoomOpenHelper(config, new RoomOpenHelper.Delegate(3) {
      @Override
      public void createAllTables(@NonNull final SupportSQLiteDatabase db) {
        db.execSQL("CREATE TABLE IF NOT EXISTS `pending_plants` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `plantTypeId` INTEGER NOT NULL, `plantTypeName` TEXT NOT NULL, `lat` REAL NOT NULL, `lng` REAL NOT NULL, `plantedAt` TEXT, `nursery` TEXT, `localPhotoPath` TEXT, `photoUrl` TEXT, `createdAt` INTEGER NOT NULL, `synced` INTEGER NOT NULL, `syncError` TEXT)");
        db.execSQL("CREATE TABLE IF NOT EXISTS `cached_plant_types` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, PRIMARY KEY(`id`))");
        db.execSQL("CREATE TABLE IF NOT EXISTS `cached_nurseries` (`id` INTEGER NOT NULL, `name` TEXT NOT NULL, PRIMARY KEY(`id`))");
        db.execSQL("CREATE TABLE IF NOT EXISTS `plant_type_colors` (`plantTypeId` INTEGER NOT NULL, `colorHex` TEXT NOT NULL, PRIMARY KEY(`plantTypeId`))");
        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, '6209430010ab8314a4d9c0225409c4b8')");
      }

      @Override
      public void dropAllTables(@NonNull final SupportSQLiteDatabase db) {
        db.execSQL("DROP TABLE IF EXISTS `pending_plants`");
        db.execSQL("DROP TABLE IF EXISTS `cached_plant_types`");
        db.execSQL("DROP TABLE IF EXISTS `cached_nurseries`");
        db.execSQL("DROP TABLE IF EXISTS `plant_type_colors`");
        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;
        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> _columnsPendingPlants = new HashMap<String, TableInfo.Column>(12);
        _columnsPendingPlants.put("id", new TableInfo.Column("id", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("plantTypeId", new TableInfo.Column("plantTypeId", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("plantTypeName", new TableInfo.Column("plantTypeName", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("lat", new TableInfo.Column("lat", "REAL", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("lng", new TableInfo.Column("lng", "REAL", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("plantedAt", new TableInfo.Column("plantedAt", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("nursery", new TableInfo.Column("nursery", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("localPhotoPath", new TableInfo.Column("localPhotoPath", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("photoUrl", new TableInfo.Column("photoUrl", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("createdAt", new TableInfo.Column("createdAt", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("synced", new TableInfo.Column("synced", "INTEGER", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPendingPlants.put("syncError", new TableInfo.Column("syncError", "TEXT", false, 0, null, TableInfo.CREATED_FROM_ENTITY));
        final HashSet<TableInfo.ForeignKey> _foreignKeysPendingPlants = new HashSet<TableInfo.ForeignKey>(0);
        final HashSet<TableInfo.Index> _indicesPendingPlants = new HashSet<TableInfo.Index>(0);
        final TableInfo _infoPendingPlants = new TableInfo("pending_plants", _columnsPendingPlants, _foreignKeysPendingPlants, _indicesPendingPlants);
        final TableInfo _existingPendingPlants = TableInfo.read(db, "pending_plants");
        if (!_infoPendingPlants.equals(_existingPendingPlants)) {
          return new RoomOpenHelper.ValidationResult(false, "pending_plants(com.parkplants.data.db.entities.PendingPlant).\n"
                  + " Expected:\n" + _infoPendingPlants + "\n"
                  + " Found:\n" + _existingPendingPlants);
        }
        final HashMap<String, TableInfo.Column> _columnsCachedPlantTypes = new HashMap<String, TableInfo.Column>(2);
        _columnsCachedPlantTypes.put("id", new TableInfo.Column("id", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsCachedPlantTypes.put("name", new TableInfo.Column("name", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        final HashSet<TableInfo.ForeignKey> _foreignKeysCachedPlantTypes = new HashSet<TableInfo.ForeignKey>(0);
        final HashSet<TableInfo.Index> _indicesCachedPlantTypes = new HashSet<TableInfo.Index>(0);
        final TableInfo _infoCachedPlantTypes = new TableInfo("cached_plant_types", _columnsCachedPlantTypes, _foreignKeysCachedPlantTypes, _indicesCachedPlantTypes);
        final TableInfo _existingCachedPlantTypes = TableInfo.read(db, "cached_plant_types");
        if (!_infoCachedPlantTypes.equals(_existingCachedPlantTypes)) {
          return new RoomOpenHelper.ValidationResult(false, "cached_plant_types(com.parkplants.data.db.entities.CachedPlantType).\n"
                  + " Expected:\n" + _infoCachedPlantTypes + "\n"
                  + " Found:\n" + _existingCachedPlantTypes);
        }
        final HashMap<String, TableInfo.Column> _columnsCachedNurseries = new HashMap<String, TableInfo.Column>(2);
        _columnsCachedNurseries.put("id", new TableInfo.Column("id", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsCachedNurseries.put("name", new TableInfo.Column("name", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        final HashSet<TableInfo.ForeignKey> _foreignKeysCachedNurseries = new HashSet<TableInfo.ForeignKey>(0);
        final HashSet<TableInfo.Index> _indicesCachedNurseries = new HashSet<TableInfo.Index>(0);
        final TableInfo _infoCachedNurseries = new TableInfo("cached_nurseries", _columnsCachedNurseries, _foreignKeysCachedNurseries, _indicesCachedNurseries);
        final TableInfo _existingCachedNurseries = TableInfo.read(db, "cached_nurseries");
        if (!_infoCachedNurseries.equals(_existingCachedNurseries)) {
          return new RoomOpenHelper.ValidationResult(false, "cached_nurseries(com.parkplants.data.db.entities.CachedNursery).\n"
                  + " Expected:\n" + _infoCachedNurseries + "\n"
                  + " Found:\n" + _existingCachedNurseries);
        }
        final HashMap<String, TableInfo.Column> _columnsPlantTypeColors = new HashMap<String, TableInfo.Column>(2);
        _columnsPlantTypeColors.put("plantTypeId", new TableInfo.Column("plantTypeId", "INTEGER", true, 1, null, TableInfo.CREATED_FROM_ENTITY));
        _columnsPlantTypeColors.put("colorHex", new TableInfo.Column("colorHex", "TEXT", true, 0, null, TableInfo.CREATED_FROM_ENTITY));
        final HashSet<TableInfo.ForeignKey> _foreignKeysPlantTypeColors = new HashSet<TableInfo.ForeignKey>(0);
        final HashSet<TableInfo.Index> _indicesPlantTypeColors = new HashSet<TableInfo.Index>(0);
        final TableInfo _infoPlantTypeColors = new TableInfo("plant_type_colors", _columnsPlantTypeColors, _foreignKeysPlantTypeColors, _indicesPlantTypeColors);
        final TableInfo _existingPlantTypeColors = TableInfo.read(db, "plant_type_colors");
        if (!_infoPlantTypeColors.equals(_existingPlantTypeColors)) {
          return new RoomOpenHelper.ValidationResult(false, "plant_type_colors(com.parkplants.data.db.entities.PlantTypeColor).\n"
                  + " Expected:\n" + _infoPlantTypeColors + "\n"
                  + " Found:\n" + _existingPlantTypeColors);
        }
        return new RoomOpenHelper.ValidationResult(true, null);
      }
    }, "6209430010ab8314a4d9c0225409c4b8", "dbb5986806a60594e12f2cc78cadd1e1");
    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, "pending_plants","cached_plant_types","cached_nurseries","plant_type_colors");
  }

  @Override
  public void clearAllTables() {
    super.assertNotMainThread();
    final SupportSQLiteDatabase _db = super.getOpenHelper().getWritableDatabase();
    try {
      super.beginTransaction();
      _db.execSQL("DELETE FROM `pending_plants`");
      _db.execSQL("DELETE FROM `cached_plant_types`");
      _db.execSQL("DELETE FROM `cached_nurseries`");
      _db.execSQL("DELETE FROM `plant_type_colors`");
      super.setTransactionSuccessful();
    } finally {
      super.endTransaction();
      _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(PendingPlantDao.class, PendingPlantDao_Impl.getRequiredConverters());
    _typeConvertersMap.put(CachedPlantTypeDao.class, CachedPlantTypeDao_Impl.getRequiredConverters());
    _typeConvertersMap.put(CachedNurseryDao.class, CachedNurseryDao_Impl.getRequiredConverters());
    _typeConvertersMap.put(PlantTypeColorDao.class, PlantTypeColorDao_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 PendingPlantDao pendingPlantDao() {
    if (_pendingPlantDao != null) {
      return _pendingPlantDao;
    } else {
      synchronized(this) {
        if(_pendingPlantDao == null) {
          _pendingPlantDao = new PendingPlantDao_Impl(this);
        }
        return _pendingPlantDao;
      }
    }
  }

  @Override
  public CachedPlantTypeDao cachedPlantTypeDao() {
    if (_cachedPlantTypeDao != null) {
      return _cachedPlantTypeDao;
    } else {
      synchronized(this) {
        if(_cachedPlantTypeDao == null) {
          _cachedPlantTypeDao = new CachedPlantTypeDao_Impl(this);
        }
        return _cachedPlantTypeDao;
      }
    }
  }

  @Override
  public CachedNurseryDao cachedNurseryDao() {
    if (_cachedNurseryDao != null) {
      return _cachedNurseryDao;
    } else {
      synchronized(this) {
        if(_cachedNurseryDao == null) {
          _cachedNurseryDao = new CachedNurseryDao_Impl(this);
        }
        return _cachedNurseryDao;
      }
    }
  }

  @Override
  public PlantTypeColorDao plantTypeColorDao() {
    if (_plantTypeColorDao != null) {
      return _plantTypeColorDao;
    } else {
      synchronized(this) {
        if(_plantTypeColorDao == null) {
          _plantTypeColorDao = new PlantTypeColorDao_Impl(this);
        }
        return _plantTypeColorDao;
      }
    }
  }
}
