package com.gym.repository; import com.gym.model.Course; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import java.time.LocalDateTime; import java.util.List; @Repository public interface CourseRepository extends JpaRepository { List findByCoachId(Long coachId); List findByType(String type); List findByStatus(String status); List findByIsAvailableTrue(); List findByStartTimeBetween(LocalDateTime start, LocalDateTime end); @Query("SELECT c FROM Course c WHERE c.currentParticipants < c.maxParticipants AND c.isAvailable = true") List findAvailableCourses(); List findByNameContaining(String keyword); }