package gc.mda.kcg.domain.event;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface PredictionEventRepository
        extends JpaRepository<PredictionEvent, Long>, JpaSpecificationExecutor<PredictionEvent> {

    Page<PredictionEvent> findByStatusInOrderByOccurredAtDesc(List<String> statuses, Pageable pageable);

    Page<PredictionEvent> findByLevelOrderByOccurredAtDesc(String level, Pageable pageable);

    Page<PredictionEvent> findByCategoryOrderByOccurredAtDesc(String category, Pageable pageable);

    Page<PredictionEvent> findByVesselMmsiOrderByOccurredAtDesc(String mmsi, Pageable pageable);

    long countByStatus(String status);
}
