package com.example.dtf.db

import android.content.Context
import androidx.room.*
import com.example.dtf.models.Category
import com.example.dtf.models.Comment
import com.example.dtf.models.Post
import com.example.dtf.models.User
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import androidx.sqlite.db.SupportSQLiteDatabase
import com.example.dtf.dao.*
import com.example.dtf.models.Like
import java.util.Date

@Database(
    entities = [
        User::class,
        Category::class,
        Post::class,
        Like::class,
        Comment::class
    ],
    version = 4,
    exportSchema = false
)
@TypeConverters(Converter::class)
abstract class AppDatabase : RoomDatabase() {
    abstract fun userDao() : UserDao
    abstract fun categoryDao() : CategoryDao
    abstract fun commentDao() : CommentDao
    abstract fun postDao() : PostDao
    abstract fun likeDao() : LikeDao

    companion object {
        public const val DB_NAME: String = "news-db"
    }
}