package pxds.apch.ldfl.lijc

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase

@Database(entities = [Kwiv::class], version = 1, exportSchema = false)
abstract class Njwa : RoomDatabase() {

    companion object {
        @Volatile
        private var mInstance: Njwa? = null
        private const val DATA_BASE_NAME = "notify_clean.db"

        @JvmStatic
        fun getInstance(context: Context): Njwa? {
            if (mInstance == null) {
                synchronized(Njwa::class.java) {
                    if (mInstance == null) {
                        mInstance = createInstance(context)
                    }
                }
            }
            return mInstance
        }

        private fun createInstance(context: Context): Njwa {
            return Room.databaseBuilder(
                context.applicationContext, Njwa::class.java, DATA_BASE_NAME
            ).build()
        }
    }

    abstract fun historyDao(): Iobc
}