package com.miya.fastcashier.dao

import androidx.room.Database
import androidx.room.RoomDatabase
import com.miya.fastcashier.beans.ViewPayOrderData
import androidx.room.Room
import com.miya.fastcashier.utils.ContextUtils


@Database(entities = [ViewPayOrderData::class],exportSchema=false, version = 1)
abstract class PayDatabase : RoomDatabase() {
    abstract fun payDataDao(): PayDataDao
}


class DatabaseKeeper {

    companion object {

        val payDatabase: PayDatabase by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            Room.databaseBuilder(
                ContextUtils.getContext(),
                PayDatabase::class.java, "pay_data"
            ).build()
        }
    }
}
