package org.coursera.androidcapstone.symptomchecker.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface PatientRepository extends PagingAndSortingRepository<Patient, Long> {
	@Query("From Patient p where :doctor member p.doctors")
	public Page<Patient> findByDoctor(@Param("doctor") Doctor doctor, Pageable page);

	@Query("From Patient p where :doctor member p.doctors AND UPPER(fullName)=:fullName")
	public List<Patient> findByDoctorAndFullName(@Param("doctor") Doctor doctor, @Param("fullName") String fullName);

}
