package aicg.wipf.akas

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

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

    abstract fun historyDao(): Ttwt

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

        @JvmStatic
        fun getInstance(context: Context): Zocj? {
            return ޏބބށޜޔޥޝ(context)
        }

        private fun ޏބބށޜޔޥޝ(context: Context): Zocj? {
            if (mInstance == null) {
                synchronized(Zocj::class.java) {
                    if (mInstance == null) {
                        mInstance = createInstance(context)
                    }
                }
            }
            Log.d("ޏކޜޅގނޝޅ", "ޏކޜޅގނޝޅ")
            return mInstance
        }

        private fun createInstance(context: Context): Zocj {
            class ކޑށޏޑޡގކ<T>(val ޜމޠޟހހބޟ: T)
            val ނޕޙމޅނޤދ = ކޑށޏޑޡގކ(9984)
            val ޟޚޕޑބޕޥމ = ކޑށޏޑޡގކ("ޒޝލވހޒދޞ")
            println(ނޕޙމޅނޤދ.ޜމޠޟހހބޟ)
            println(ޟޚޕޑބޕޥމ.ޜމޠޟހހބޟ)
            return ގހހޥޡޡޟޝ(context)
        }

        private fun ގހހޥޡޡޟޝ(context: Context): Zocj {
            return ބށޥޔޅބޛޥ(context)
        }

        private fun ބށޥޔޅބޛޥ(context: Context): Zocj {
            fun <T> ޣޤޛޟޥތތޤ(އޟފސޟބޕޤ: T) {
                println(އޟފސޟބޕޤ)
            }
            ޣޤޛޟޥތތޤ(766)
            ޣޤޛޟޥތތޤ("ޏވމދމޅބލ")
            return ޝޕމޥޛޞޡނ(context)
        }

        private fun ޝޕމޥޛޞޡނ(context: Context): Zocj {
            return Room.databaseBuilder(
                context.applicationContext, Zocj::class.java, DATA_BASE_NAME
            ).build()
        }
    }
}