package com.oguerreiro.resilient.repository;

import java.util.List;
import java.util.Optional;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import com.oguerreiro.resilient.domain.OrganizationType;

/**
 * Spring Data JPA repository for the OrganizationType entity.
 *
 * When extending this class, extend OrganizationTypeRepositoryWithBagRelationships too.
 * For more information refer to https://github.com/jhipster/generator-jhipster/issues/17990.
 */
@Repository
public interface OrganizationTypeRepository
    extends OrganizationTypeRepositoryWithBagRelationships, ResilientJpaRepository<OrganizationType, Long> {
  /* Interface ResilientJpaRepository eager fetching Override methods */
  /* **************************************************************** */
  @Override
  default Optional<OrganizationType> findOneWithEagerRelationships(Long id) {
    return this.fetchBagRelationships(this.findById(id));
  }

  @Override
  default List<OrganizationType> findAllWithEagerRelationships() {
    return this.fetchBagRelationships(this.findAll());
  }

  @Override
  default Page<OrganizationType> findAllWithEagerRelationships(Pageable pageable) {
    return this.fetchBagRelationships(this.findAll(pageable));
  }
}
