package com.example.calendaryapp;

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

import java.util.List;

@Dao
public interface NoteDao {
    //objeto de accesso de datos
    //interfas para la base de datos
    //implementado por Room
    @Insert
    void insert(Note note);
    @Update
    void update(Note note);
    @Delete
    void delete(Note note);
    @Query("DELETE FROM note_table")
    void deleteAllNotes();
    @Query("SELECT * FROM note_table WHERE priority<10 ORDER BY priority ASC")
    LiveData<List<Note>> getAllNotes();
    @Query("SELECT * FROM note_table WHERE (priority>=10)&(priority<20) ORDER BY priority ASC")
    LiveData<List<Note>> getAllNotesMar();
    @Query("SELECT * FROM note_table WHERE (priority>=20)&(priority<30) ORDER BY priority ASC")
    LiveData<List<Note>> getAllNotesMie();
    @Query("SELECT * FROM note_table WHERE (priority>=30)&(priority<40) ORDER BY priority ASC")
    LiveData<List<Note>> getAllNotesJue();
    @Query("SELECT * FROM note_table WHERE priority>=40 ORDER BY priority ASC")
    LiveData<List<Note>> getAllNotesVie();

}
