package com.pixelized.biblib.database

import androidx.room.Database
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.pixelized.biblib.database.converter.DateConverter
import com.pixelized.biblib.database.crossref.BookAuthorCrossRef
import com.pixelized.biblib.database.crossref.BookGenreCrossRef
import com.pixelized.biblib.database.dao.*
import com.pixelized.biblib.database.data.*

@Database(
    entities = [
        AuthorDbo::class,
        BookDbo::class,
        GenreDbo::class,
        LanguageDbo::class,
        SeriesDbo::class,
        BookAuthorCrossRef::class,
        BookGenreCrossRef::class,
    ],
    version = BibLibDatabase.VERSION
)
@TypeConverters(DateConverter::class)
abstract class BibLibDatabase : RoomDatabase() {

    abstract fun authorDao(): AuthorDao
    abstract fun bookDao(): BookDao
    abstract fun genreDao(): GenreDao
    abstract fun languageDao(): LanguageDao
    abstract fun seriesDao(): SeriesDao
    abstract fun crossRefDao(): CrossRefDao
    abstract fun searchDao(): SearchDao

    companion object {
        const val VERSION = 1
        const val DATABASE_NAME = "BibLibDataBase"
    }
}