package inn.ocsf.bee.freigeld.core.repo;

import inn.ocsf.bee.freigeld.core.model.TicketStatus;
import inn.ocsf.bee.freigeld.core.model.data.TicketData;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Stream;

public interface TicketRepository extends MongoRepository<TicketData, ObjectId>, QuerydslPredicateExecutor<TicketData> {

    Optional<TicketData> findOneByTicketId(UUID ticket_id);

    Stream<TicketData> findAllByTopicAndStatusInOrderByTsDesc(String topic, List<TicketStatus> status);
}
