package com.davos.assessment.project;

import com.davos.assessment.assessment.Assessment;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ProjectAssessmentRepository extends JpaRepository<ProjectAssessment, Long> {
  @EntityGraph(attributePaths = "assessment")
  List<ProjectAssessment> findByProjectAndActiveTrue(Project project);

  @EntityGraph(attributePaths = "assessment")
  List<ProjectAssessment> findByProject(Project project);

  @EntityGraph(attributePaths = "assessment")
  Optional<ProjectAssessment> findByProjectAndAssessment(Project project, Assessment assessment);
}
