package cz.muni.sutralog.database

import androidx.lifecycle.LiveData
import androidx.room.*

@Dao
interface RockDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun saveRock(rock: RockEntity): Long

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun saveRocks(rocks: List<RockEntity>)

    @Query("SELECT * FROM RockEntity")
    fun getAllRocks(): List<RockEntity>

    @Query("SELECT * FROM RockEntity WHERE categoryId = :categoryId")
    fun getRocksByCategoryId(categoryId: Long): List<RockEntity>

    @Query("SELECT * FROM RockEntity WHERE id = :id")
    fun getRockById(id: Long): RockEntity

    @Query("DELETE FROM RockEntity WHERE id = :id")
    fun deleteRockById(id: Long)

    @Delete(entity = RockEntity::class)
    fun deleteRock(rock: RockEntity)
}
