package com.example.myapplication.database.room.repository.offline

import com.example.myapplication.database.room.dao.rent.RentItemCrossRefDao
import com.example.myapplication.database.room.model.rent.RentItemCrossRef
import com.example.myapplication.database.room.repository.online.RentItemRepository


class OfflineRentItemRepository(private val rentItemDao: RentItemCrossRefDao) :
    RentItemRepository {
    override suspend fun insertRentItem(rentItemCrossRef: RentItemCrossRef) =
        rentItemDao.insert(rentItemCrossRef)

    override suspend fun updateRentItem(rentItemCrossRef: RentItemCrossRef) =
        rentItemDao.update(rentItemCrossRef)

    override suspend fun deleteRentItem(rentItemCrossRef: RentItemCrossRef) =
        rentItemDao.delete(rentItemCrossRef)

    suspend fun deleteRentItems(userId: Int) = rentItemDao.deleteByRentUid(userId)

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