package com.eshore.gringotts.web.domain.repository;

import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
import com.eshore.gringotts.web.domain.entity.Confirmation;
import java.util.List;
import java.util.Optional;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.stereotype.Repository;

/**
 * @author lanyuanxiaoyao
 * @date 2024-11-26
 */
@SuppressWarnings("NullableProblems")
@Repository
public interface ConfirmationRepository extends SimpleRepository<Confirmation, Long> {
    @Override
    @EntityGraph(value = "confirmation.list", type = EntityGraph.EntityGraphType.FETCH)
    List<Confirmation> findAll(Specification<Confirmation> specification);

    @Override
    @EntityGraph(value = "confirmation.list", type = EntityGraph.EntityGraphType.FETCH)
    List<Confirmation> findAll(Specification<Confirmation> specification, Sort sort);

    @Override
    @EntityGraph(value = "confirmation.detail", type = EntityGraph.EntityGraphType.FETCH)
    Optional<Confirmation> findOne(Specification<Confirmation> specification);

    Boolean existsByTarget_Id(Long id);
}
