package com.example.shawarma.data.repos

import com.example.shawarma.data.interfaces.dao.UserDao
import com.example.shawarma.data.models.UserModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

class UserRepository @Inject constructor(
    private val userDao: UserDao
)  {
    suspend fun insert(user: UserModel) {
        return userDao.insert(user)
    }
    suspend fun update (user: UserModel) {
        return userDao.update(user)
    }
    suspend fun delete (user: UserModel) {
        return userDao.delete(user)
    }
    fun getAll(): Flow<List<UserModel>> {
        return userDao.getAll()
    }
    fun getById(id: Int): Flow<UserModel> {
        return userDao.getById(id)
    }
    fun login(login: String, password: String): Flow<UserModel?> {
        return userDao.login(login, password)
    }
}