package com.iqser.red.service.persistence.service.v1.api.shared.mongo.repository;

import java.util.Optional;

import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;

import com.iqser.red.service.persistence.service.v1.api.shared.mongo.document.EntityLogDocument;

@Repository
public interface EntityLogDocumentRepository extends MongoRepository<EntityLogDocument, String> {

    @Query(value = "{ 'id' : ?0 }", fields = "{ 'analysisNumber' : 1 }")
    Optional<EntityLogDocument> findAnalysisNumberById(String id);


    @Query(value = "{ 'id': ?0 }", fields = "{ 'entityLogEntryDocuments': 0 }")
    Optional<EntityLogDocument> findEntityLogDocumentWithoutEntriesById(String id);

}
