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.ComponentLogDocument;

@Repository
public interface ComponentLogDocumentRepository extends MongoRepository<ComponentLogDocument, String> {

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


    @Query(value = "{ 'id': ?0 }", fields = "{ 'componentLogEntryDocuments': 0 }")
    Optional<ComponentLogDocument> findComponentLogDocumentWithoutEntriesById(String id);

}
