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 GroupDao {

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

    @Query("select * from `Group` where group_id = :id")
    fun get(id: String): LiveData<List<Group>>

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

    @Query("delete from `Group`")
    suspend fun deleteAll()

}