package com.example.lab2;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Update;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

import java.util.List;

@Dao
public interface PhoneDao {
    @Insert(onConflict = OnConflictStrategy.IGNORE)
    void insert(Phone phone);

    @Query("DELETE FROM phones")
    void deleteAll();

    @Delete
    void delete(Phone phone);

    @Update
    void update(Phone phone);

    @Query("SELECT * FROM phones ORDER BY producer ASC")
    LiveData<List<Phone>> getAllPhones();
}
