package com.infinite.focus.server.home;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.infinite.focus.server.auth.Instructor;
import com.infinite.focus.server.auth.Student;
import com.infinite.focus.server.tests.CorrectAnswer;
import com.infinite.focus.server.wall.WallPost;

//Handles CRUD operations for quotes table



@Repository
public interface MoodUpdateRepository extends JpaRepository<MoodUpdate, Long> {
	
	// Full query
	@Query(value = "SELECT * FROM mood_update ORDER BY mood_update_id", nativeQuery = true)
	List<MoodUpdate> findAllOrderById();
	
	@Query(value = "SELECT * FROM mood_update WHERE student_id = ?1 ORDER BY created_at DESC", nativeQuery = true)
	List<MoodUpdate> findByStudentId(Long student_id);	
	
	@Query(value = "SELECT * FROM mood_update WHERE student_id = ?1 AND created_at >= DATE_SUB(Now(),INTERVAL 3 DAY) ORDER BY created_at DESC", nativeQuery = true)
	List<MoodUpdate> findByStudentIdInLast3Days(Long student_id);	

}