package com.example.myapplication.database.room.dao.user

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.room.model.user.UserItemCrossRef

@Dao
interface UserItemCrossRefDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(userItemCrossRef: UserItemCrossRef)

    @Update
    suspend fun update(userItemCrossRef: UserItemCrossRef)

    @Delete
    suspend fun delete(userItemCrossRef: UserItemCrossRef)

    @Query("DELETE FROM users_items where users_items.user_id = :userId")
    suspend fun deleteByUserUid(userId: Int)

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