package com.example.myapplication.database.entities.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.example.myapplication.database.entities.model.RentItemCrossRef

@Dao
interface RentItemCrossRefDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(rentItemCrossRef: RentItemCrossRef)

    @Update
    suspend fun update(rentItemCrossRef: RentItemCrossRef)

    @Delete
    suspend fun delete(rentItemCrossRef: RentItemCrossRef)

    @Query("DELETE FROM rents_items where rents_items.rent_id = :rentId")
    suspend fun deleteByRentUid(rentId: Int)

    @Query("DELETE FROM rents_items where rents_items.item_id = :itemId")
    suspend fun deleteByItemUid(itemId: Int)
}