package com.fun.airhornprank.data;

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

import java.util.List;

@Dao
public interface LikeDAO {
    @Query("SELECT * FROM prank_table")
    List<Mydata> getAll();

    @Query("SELECT * FROM prank_table")
    LiveData<List<Mydata>> livegetAll();

    @Query("select * from prank_table where islike =:islike ")
    LiveData<List<Mydata>> getLikedata(boolean islike);
    @Query("select * from prank_table where isRank =:isrank ")
    LiveData<List<Mydata>> getRankdata(boolean isrank);
    @Query("select * from prank_table where title =:title ")
    List<Mydata> getliketitle(String title);

    @Query("select * from prank_table where categoryname =:name ")
    List<Mydata> getlist(String name);

    @Query("select * from prank_table where categoryname =:name ")
    LiveData<List<Mydata>> getCustom(String name);

    @Insert
    void insertAll(List<Mydata> likeDataList);

    @Insert
    void insertCustom(Mydata mydata);

    @Query("DELETE FROM prank_table WHERE title = :title")
    void deleteByTitle(String title);

    @Query("DELETE FROM prank_table WHERE id = :id")
    void deleteCutsom(int id);

    @Update
    void update(Mydata likeData);
}
