// Path: neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/utils/DataConverterUtils.java
// public static Map<String, Object> nodeToMap(Node value) {
//     Map<String, Object> nodeMap = new LinkedHashMap<>();
//     nodeMap.put("_id", value.id());
//     nodeMap.put("_labels", value.labels());
//     nodeMap.putAll(convertFields(value.asMap()));
//     return nodeMap;
// }
// 
// Path: neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/utils/DataConverterUtils.java
// public static Map<String, Object> relationshipToMap(Relationship value) {
//     Map<String, Object> relMap = new LinkedHashMap<>();
//     relMap.put("_id", value.id());
//     relMap.put("_type", value.type());
//     relMap.put("_startId", value.startNodeId());
//     relMap.put("_endId", value.endNodeId());
//     relMap.putAll(convertFields(value.asMap()));
//     return relMap;
// }


import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.neo4j.driver.types.Path;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.neo4j.jdbc.utils.DataConverterUtils.nodeToMap;
import static org.neo4j.jdbc.utils.DataConverterUtils.relationshipToMap;
package org.neo4j.jdbc.utils;




public class PathSerializer extends JsonSerializer<Path> {
    @Override
    public void serialize(Path value, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
        List<Map<String, Object>> list = toPath(value);
        jsonGenerator.writeObject(list);
    }

    public static List<Map<String, Object>> toPath(Path value) {
        List<Map<String, Object>> list = new ArrayList<>();
        list.add(nodeToMap(value.start()));
        for (Path.Segment s : value) {
// Path: neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/utils/DataConverterUtils.java
// public static Map<String, Object> nodeToMap(Node value) {
//     Map<String, Object> nodeMap = new LinkedHashMap<>();
//     nodeMap.put("_id", value.id());
//     nodeMap.put("_labels", value.labels());
//     nodeMap.putAll(convertFields(value.asMap()));
//     return nodeMap;
// }
// 
// Path: neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/utils/DataConverterUtils.java
// public static Map<String, Object> relationshipToMap(Relationship value) {
//     Map<String, Object> relMap = new LinkedHashMap<>();
//     relMap.put("_id", value.id());
//     relMap.put("_type", value.type());
//     relMap.put("_startId", value.startNodeId());
//     relMap.put("_endId", value.endNodeId());
//     relMap.putAll(convertFields(value.asMap()));
//     return relMap;
// }


// Path: neo4j-jdbc-bolt/src/main/java/org/neo4j/jdbc/utils/PathSerializer.java
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.neo4j.driver.types.Path;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.neo4j.jdbc.utils.DataConverterUtils.nodeToMap;
import static org.neo4j.jdbc.utils.DataConverterUtils.relationshipToMap;

package org.neo4j.jdbc.utils;




public class PathSerializer extends JsonSerializer<Path> {
    @Override
    public void serialize(Path value, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
        List<Map<String, Object>> list = toPath(value);
        jsonGenerator.writeObject(list);
    }

    public static List<Map<String, Object>> toPath(Path value) {
        List<Map<String, Object>> list = new ArrayList<>();
        list.add(nodeToMap(value.start()));
        for (Path.Segment s : value) {
            list.add(relationshipToMap(s.relationship()));