package org.diagbot.repository;

import org.diagbot.entity.node.base.BaseNode;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;

import java.util.List;
import java.util.Map;
import java.util.stream.Stream;

public interface BaseNodeRepository extends Neo4jRepository<BaseNode, Long> {
    // update Node by Name
    @Query("MATCH (n) WHERE ID(n) = {0} SET n.name = {2} RETURN n")
    BaseNode updateNodeByName(int id, String old_name, String new_name);

    // get All Node
    @Query("MATCH (n) RETURN n.name as name, LABELS(n) as label")
    List<Map<String, Object>> getAllNode();

//    Stream<BaseNode> findAllBy();
}
