package com.github.nullptroma.wallenc.infrastructure.android.db.app

import androidx.room.Database
import androidx.room.RoomDatabase
import com.github.nullptroma.wallenc.infrastructure.android.db.app.dao.StorageKeyMapDao
import com.github.nullptroma.wallenc.infrastructure.android.db.app.dao.StorageMetaInfoDao
import com.github.nullptroma.wallenc.infrastructure.android.db.app.dao.StorageSyncGroupDao
import com.github.nullptroma.wallenc.infrastructure.android.db.app.dao.YandexAccountDao
import com.github.nullptroma.wallenc.infrastructure.android.db.app.model.DbStorageKeyMap
import com.github.nullptroma.wallenc.infrastructure.android.db.app.model.DbStorageMetaInfo
import com.github.nullptroma.wallenc.infrastructure.android.db.app.model.DbStorageSyncGroup
import com.github.nullptroma.wallenc.infrastructure.android.db.app.model.DbYandexAccount

interface IAppDb {
    val storageKeyMapDao: StorageKeyMapDao
    val storageMetaInfoDao: StorageMetaInfoDao
    val storageSyncGroupDao: StorageSyncGroupDao
    val yandexAccountDao: YandexAccountDao
}

@Database(
    entities = [DbStorageKeyMap::class, DbStorageMetaInfo::class, DbYandexAccount::class, DbStorageSyncGroup::class],
    version = 5,
    exportSchema = false
)
abstract class AppDb : IAppDb, RoomDatabase() {
    abstract override val storageKeyMapDao: StorageKeyMapDao
    abstract override val storageMetaInfoDao: StorageMetaInfoDao
    abstract override val storageSyncGroupDao: StorageSyncGroupDao
    abstract override val yandexAccountDao: YandexAccountDao
}
