package com.davos.assessment.report;

import com.davos.assessment.assessment.Submission;
import com.davos.assessment.project.Project;
import com.davos.assessment.user.AppUser;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ReportRepository extends JpaRepository<Report, Long> {
  Optional<Report> findBySubmission(Submission submission);
  Optional<Report> findFirstByUserOrderByCreatedAtDesc(AppUser user);
  List<Report> findAllByOrderByCreatedAtDesc();
  List<Report> findByProjectOrderByCreatedAtDesc(Project project);
  long countByProject(Project project);
  List<Report> findBySubmissionIdIn(Collection<Long> submissionIds);
  List<Report> findByProjectAndSubmissionIdIn(Project project, Collection<Long> submissionIds);
}
