package com.example.pmulabs.room.repository

import com.example.pmulabs.room.dao.UserDao
import com.example.pmulabs.room.models.Article
import com.example.pmulabs.room.models.Comment
import com.example.pmulabs.room.models.Tag
import com.example.pmulabs.room.models.User
import kotlinx.coroutines.flow.Flow

class OfflineUserRepository(private val userDao: UserDao) : UserRepository {
    override suspend fun insertUser(user: User) = userDao.insert(user)
    override suspend fun updateUser(user: User) = userDao.update(user)
    override suspend fun deleteUser(user: User) = userDao.delete(user)
    override fun getAllUsers(): Flow<List<User>> = userDao.getAll()
    override fun getUserById(idUser: Int?): Flow<User> = userDao.getUserById(idUser)
    override fun getUserComms(idUser: Int): Flow<List<Comment>> = userDao.getUserComms(idUser)
    override fun getUserArticles(idUser: Int): Flow<List<Article>> = userDao.getUserArticles(idUser)
    override fun getUserTags(idUser: Int): Flow<List<Tag>> = userDao.getUserTags(idUser)
}