[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "graphviz/gvc.h")]
namespace Gvc {

/*
TODO:
Is "unowned" or "weak" correct for agget() returned strings?
*/

	[CCode (cname = "aginit")]
	public void aginit ();

	[Compact]
	[CCode (cname = "GVC_t", ref_function = "", unref_function = "")]
	public class Context {
		[CCode (cname = "gvContext")]
		public Context ();

		[CCode (cname = "gvLayout")]
		public void layout (Graph graph, string layout_engine);

		[CCode (cname = "gvFreeLayout")]
		public void free_layout (Graph graph);

		[CCode (cname = "gvRender")]
		public void render (Graph graph, string file_type, GLib.FileStream? file);

		[CCode (cname = "gvRenderFilename")]
		public void render_filename (Graph graph, string file_type, string filename);

		[CCode (cname = "gvFreeContext")]
		public void free ();

	}

	[Compact]
	[CCode (cname = "Agnode_t", ref_function = "", unref_function = "")]
	public class Node {
		[CCode (cname = "agget")]
		public unowned string? get (string attribute_name);

		[CCode (cname = "agsafeset")]
		public void safe_set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value, string? default_value);
	}

	[Compact]
	[CCode (cname = "Agedge_t", ref_function = "", unref_function = "")]
	public class Edge {
		[CCode (cname = "agget")]
		public unowned string? get (string attribute_name);

		[CCode (cname = "agsafeset")]
		public void safe_set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value, string? default_value);
	}

	[CCode (cprefix = "")]
	public enum GraphKind {
		AGRAPH,
		AGRAPHSTRICT,
		AGDIGRAPH,
		AGDIGRAPHSTRICT,
		AGMETAGRAPH,
	}

	[Compact]
	[CCode (cname = "Agraph_t", ref_function = "", unref_function = "")]
	public class Graph {
		[CCode (cname = "agopen")]
		public Graph (string graph_name, GraphKind kind);

		[CCode (cname = "agclose")]
		public void close ();

		[CCode (cname = "agnode")]
		public Node create_node ([CCode (type = "char*")] string node_name);

		[CCode (cname = "agedge")]
		public Edge create_edge (Node from, Node to);

		[CCode (cname = "agfindnode")]
		public Node? find_node (string node_name);

		[CCode (cname = "agfstnode")]
		public Node? get_first_node ();

		[CCode (cname = "agnxtnode")]
		public Node? get_next_node (Node node);

		[CCode (cname = "agget")]
		public unowned string? get (string attribute_name);

		[CCode (cname = "agsafeset")]
		public Edge safe_set (string attribute_name, string attribute_value, string? default_value);

	}

	/**
	 * Graphviz has this concept of "referenced counted strings" to save memory.
	 * In addition, there is a special type of string in Graphviz called an "HTML string".
	 * More information about graphviz "HTML strings" can be found at:
	 * http://www.graphviz.org/doc/info/shapes.html#html
	 * And also near the end of page 9 in:  http://graphviz.org/pdf/libguide.pdf
	 */
	[CCode (cname = "char", copy_function = "agdupstr_html", free_function = "agstrfree")]
	public class HtmlString : string
	{
		[CCode (cname = "agstrdup_html")]
		public HtmlString (string markup);
	}
}
