Code/Dependencies/DotNetGraph/Extensions/DotEdgeExtensions.cs
using Nodebox.Dependencies.DotNetGraph.Attributes;
using Nodebox.Dependencies.DotNetGraph.Core;

namespace Nodebox.Dependencies.DotNetGraph.Extensions {
    public static class DotEdgeExtensions {
        public static DotEdge Source(this DotEdge edge, string source, bool isHtml = false) {
            edge.Source = new DotIdentifier(source, isHtml);
            return edge;
        }

        public static DotEdge Source(this DotEdge edge, DotNode source) {
            edge.Source = source.Identifier;
            return edge;
        }

        public static DotEdge From(this DotEdge edge, DotNode source) => Source(edge, source);

        public static DotEdge Destination(this DotEdge edge, string to, bool isHtml = false) {
            edge.Destination = new DotIdentifier(to, isHtml);
            return edge;
        }

        public static DotEdge To(this DotEdge edge, string to, bool isHtml = false) => Destination(edge, to, isHtml);

        public static DotEdge Destination(this DotEdge edge, DotNode to) {
            edge.Destination = to.Identifier;
            return edge;
        }

        public static DotEdge To(this DotEdge edge, DotNode to) => Destination(edge, to);

        public static DotEdge WithColor(this DotEdge edge, string color) {
            edge.Color = new DotColorAttribute(color);
            return edge;
        }

        public static DotEdge WithColor(this DotEdge edge, DotColor color) {
            edge.Color = new DotColorAttribute(color);
            return edge;
        }

        public static DotEdge WithStyle(this DotEdge edge, string style) {
            edge.Style = new DotEdgeStyleAttribute(style);
            return edge;
        }

        public static DotEdge WithStyle(this DotEdge edge, DotEdgeStyle style) {
            edge.Style = new DotEdgeStyleAttribute(style);
            return edge;
        }

        public static DotEdge WithPenWidth(this DotEdge edge, double width) {
            edge.PenWidth = new DotDoubleAttribute(width);
            return edge;
        }

        public static DotEdge WithArrowHead(this DotEdge edge, string arrowType) {
            edge.ArrowHead = new DotEdgeArrowTypeAttribute(arrowType);
            return edge;
        }

        public static DotEdge WithArrowHead(this DotEdge edge, DotEdgeArrowType arrowType) {
            edge.ArrowHead = new DotEdgeArrowTypeAttribute(arrowType);
            return edge;
        }

        public static DotEdge WithArrowTail(this DotEdge edge, string arrowType) {
            edge.ArrowTail = new DotEdgeArrowTypeAttribute(arrowType);
            return edge;
        }

        public static DotEdge WithArrowTail(this DotEdge edge, DotEdgeArrowType arrowType) {
            edge.ArrowTail = new DotEdgeArrowTypeAttribute(arrowType);
            return edge;
        }

        public static DotEdge WithPos(this DotEdge edge, string value) {
            edge.Pos = new DotPointAttribute(value);
            return edge;
        }

        public static DotEdge WithPos(this DotEdge edge, int x, int y, bool @fixed = false) {
            edge.Pos = new DotPointAttribute(new DotPoint(x, y, @fixed));
            return edge;
        }

        public static DotEdge WithPos(this DotEdge edge, int x, int y, int z, bool @fixed = false) {
            edge.Pos = new DotPointAttribute(new DotPoint(x, y, z, @fixed));
            return edge;
        }
    }
}