package org.raddatz.familienarchiv.geschichte;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Optional;
import java.util.UUID;

/**
 * Thin read-only service owning {@link GeschichteRepository}.
 * Exists so that {@code JourneyItemService} can check Geschichte existence
 * and load Geschichte instances without holding a direct reference to the
 * Geschichte repository (cross-domain repository access is not allowed per
 * layering rules).
 */
@Service
@RequiredArgsConstructor
public class GeschichteQueryService {

    private final GeschichteRepository geschichteRepository;

    public boolean existsById(UUID id) {
        return geschichteRepository.existsById(id);
    }

    public Optional<Geschichte> findById(UUID id) {
        return geschichteRepository.findById(id);
    }
}
