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

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

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

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

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

}