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

import com.eshore.gringotts.web.domain.base.repository.SimpleRepository;
import com.eshore.gringotts.web.domain.entity.Ware;
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;

@SuppressWarnings("NullableProblems")
@Repository
public interface WareRepository extends SimpleRepository<Ware, Long> {
    @Override
    @EntityGraph(value = "ware.list", type = EntityGraph.EntityGraphType.FETCH)
    List<Ware> findAll(Specification<Ware> specification);

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

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