package com.example.wallpapermagazine.LoveDAO;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao
public interface FavoriteImageDao {
    @Insert
    void insert(FavoriteImage favoriteImage);


    @Query("SELECT * FROM favorite_images")
    List<FavoriteImage> getAllFavoriteImages();

    @Query("SELECT * FROM favorite_images where image_url =:url")
    FavoriteImage getImageUrl(String url);

    @Query("SELECT * FROM favorite_images WHERE image_url = :name LIMIT 1")
    LiveData<FavoriteImage> getDataByname(String name);


    @Update
    void updateUser(FavoriteImage favoriteImage);


    @Delete
    void deleteUser(FavoriteImage favoriteImage);
}