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

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

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

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

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

}