

package com.colorful.keyboard.theme.room

import androidx.room.*
import com.colorful.keyboard.theme.bean.DownloadBean

@Dao
interface DownloadDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertDownload(downloadBean: DownloadBean)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertDownloads(downloadBean: List<DownloadBean>)

    @Query("SELECT * FROM DownloadBean")
    suspend fun getAllDownload(): List<DownloadBean>

    @Delete
    suspend fun deleteDownload(downloadBean: DownloadBean)

    @Query("DELETE FROM DownloadBean")
    suspend fun deleteAllDownload()

    @Update
    suspend fun updateDownload(downloadBean: DownloadBean)

    @Query("SELECT * FROM DownloadBean WHERE `key` = :key LIMIT 1")
    suspend fun getDownloadByKey(key: String): DownloadBean?
}
