package com.sunny.app.soft.timberkeyboardnew.room;

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 com.sunny.app.soft.timberkeyboardnew.data.entity.BackgroundEntity;

import java.util.List;

@Dao
public interface BackgroundDao {

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    long insertData(BackgroundEntity data);


    @Query("select * from keyboard order by RANDOM() LIMIT 1")
    BackgroundEntity queryRandomItem();


    @Query("select * from keyboard  where categoryId = :cateId")
    LiveData<List<BackgroundEntity>> queryCateId(long cateId);


    @Query("select * from keyboard  where `like` = :collect")
    LiveData<List<BackgroundEntity>> queryCollect(boolean collect);

    @Update()
    void updateCollect(BackgroundEntity entity);


}
