package com.gh.download.simple

import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.halo.assistant.HaloApp

@Database(
    entities = [SimpleDownloadEntity::class],
    version = 1,
    exportSchema = false
)
@TypeConverters(DownloadStatusConverter::class)
abstract class SimpleDownloadDatabase : RoomDatabase() {

    abstract fun downloadDao(): DownloadDao

    companion object {
        @JvmStatic
        val instance by lazy {
            Room.databaseBuilder(
                HaloApp.getInstance().application,
                SimpleDownloadDatabase::class.java,
                "SIMPLE_DOWNLOAD_DATABASE"
            ).build()
        }
    }

}