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

import java.util.List;
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.ComponentLogEntryDocument;

@Repository
public interface ComponentLogEntryDocumentRepository extends MongoRepository<ComponentLogEntryDocument, String> {

    @Query(value = "{ 'componentLogId' : ?0}", delete = true)
    void deleteByComponentLogId(String componentLogId);


    @Query(value = "{ 'componentLogId': ?0 }")
    List<ComponentLogEntryDocument> findByComponentLogId(String componentLogId);


    @Query(value = "{ 'componentLogId': ?0, 'softDeletedTime': { $eq: null } }")
    List<ComponentLogEntryDocument> findByComponentLogIdExcludeSoftDeleted(String componentLogId);

}
