package org.cmh.backend.MeetingManagement.repository;

import org.cmh.backend.MeetingManagement.model.Meeting;
import org.springframework.data.jpa.repository.JpaRepository;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.data.jpa.repository.Query;

public interface MeetingRepository extends JpaRepository<Meeting, Long> {
    @Query("SELECT m FROM Meeting m WHERE " +
            "(?1 IS NULL OR m.name LIKE %?1%) AND " +
            "(?2 IS NULL OR m.organizer LIKE %?2%) AND " +
            "(?3 IS NULL OR m.startTime >= ?3)")
    List<Meeting> searchMeetings(String name, String organizer, LocalDateTime startTime);
}
