package com.example.myapplication.database.entities.repository

import com.example.myapplication.database.entities.dao.UserItemCrossRefDao
import com.example.myapplication.database.entities.model.UserItemCrossRef

class OfflineUserItemRepository(private val userItemDao: UserItemCrossRefDao) :
    UserItemRepository {
    override suspend fun insertUserItem(userItemCrossRef: UserItemCrossRef) =
        userItemDao.insert(userItemCrossRef)

    override suspend fun updateUserItem(userItemCrossRef: UserItemCrossRef) =
        userItemDao.update(userItemCrossRef)

    override suspend fun deleteUserItem(userItemCrossRef: UserItemCrossRef) =
        userItemDao.delete(userItemCrossRef)

    override suspend fun deleteUserItems(userId: Int) = userItemDao.deleteByUserUid(userId)

    suspend fun deleteItemsByUid(itemId: Int) = userItemDao.deleteByItemUid(itemId)
}