using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace GraphDrawer
{
    public class Edge
    {
        public Line line { get; set; }
        public ArrowLine arrowLine { get; set; }
        public Vertex startVertex { get; set; }
        public Vertex finishVertex { get; set; }
        public int? Weight { get; set; }
        
        public Edge(Line line, Vertex v1, Vertex v2)
        {
            this.line = line;
            startVertex = v1;
            finishVertex = v2;
        }

        public Edge(ArrowLine line, Vertex v1, Vertex v2)
        {
            this.arrowLine = line;
            startVertex = v1;
            finishVertex = v2;
        }

        public Edge(Line line, Vertex v1, Vertex v2, int weight)
        {
            this.line = line;
            startVertex = v1;
            finishVertex = v2;
            Weight = weight;
        }

        public static double GetCenterByX(Edge edge)
        {
            int x;
            if (edge.finishVertex.X - edge.startVertex.X > 0)
            {
                x = edge.finishVertex.X - edge.startVertex.X;
            }
            else
            {
                x = edge.startVertex.X - edge.finishVertex.X;
            }
            return x;
        }

        public static double GetCenterByY(Edge edge)
        {
            int y;
            if (edge.finishVertex.Y - edge.startVertex.Y > 0)
            {
                y = edge.finishVertex.Y - edge.startVertex.Y;
            }
            else
            {
                y = edge.startVertex.Y - edge.finishVertex.Y;
            }
            return y;
        }
    }
}