package io.nexilis.service.data.daos

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import io.nexilis.service.data.entities.*

@Dao
interface PrefsDao {

    @Query("select * from Prefs")
    fun getAll(): LiveData<List<Prefs>>

    @Query("select * from Prefs where `key` = :key")
    fun get(key: String): LiveData<List<Prefs>>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(entity: Prefs)

    @Query("delete from Prefs")
    suspend fun deleteAll()

}