package com.wx.application.nebula.graph.query;

import java.util.Map;

import com.vesoft.nebula.client.graph.data.ValueWrapper;
import com.wx.application.nebula.graph.base.ResultSetUtils;

import cn.hutool.json.JSONObject;
import lombok.Data;

@Data
public class NebulaNode {
	
	private String vid;
	
	private String labels;
	
	private JSONObject properties;

	
	public void setProperties(JSONObject obj) {
		this.properties = obj;
	}
	
	public void setProperties(Map<String, ValueWrapper> propertiesMap) {
		JSONObject obj = new JSONObject();
		for (Map.Entry<String, ValueWrapper> pro : propertiesMap.entrySet()) {
			obj.set(pro.getKey(), ResultSetUtils.printValueWrapper(pro.getValue()));
		}
		this.properties = obj;
	}

	
	@Override
	public boolean equals(Object obj) {
		NebulaNode u = (NebulaNode) obj;
		return this.getVid().equals(u.getVid());
	}

	@Override
	public int hashCode() {
		String in = this.getVid();
		return in.hashCode();
	}
}
