using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EHEC_Server
{
    public class Edge
    {
        public int Source { get; set; }
        public int Target { get; set; }
        public string Edgetype { get; set; }
        public Edge() { }
        public List<Edge> GetEdges()
        {
            List<Edge> X = new List<Edge>();
            X.AddRange(GetClusterRelationsPatientsOrigins());
            X.AddRange(GetClusterRelationsPatientsResults());
            return X;
        }
        public List<Edge> GetClusterRelationsPatientsOrigins()
        {
            Exam exam = new Exam();
            List<Exam> exams = new List<Exam>();
            exams = exam.GetAllExams();
            List<Edge> clusterEdges = new List<Edge>();
            foreach (Exam element in exams)
            {
                Edge clusterEdge = new Edge
                {
                    Edgetype = "Angesteckt in ",
                    Source = element.PatientId,
                    Target = element.DoctorId   ///for tests !!!!!!!!!!!!!!!! correct it to Origin id somehow!!!!!!!!
                };
                clusterEdges.Add(clusterEdge);
            }
            return clusterEdges;
        }
        public List<Edge> GetClusterRelationsPatientsResults()
        {
            Exam exam = new Exam();
            List<Exam> exams = new List<Exam>();
            exams = exam.GetAllExams();
            List<Edge> clusterEdges = new List<Edge>();
            foreach (Exam element in exams)
            {
                Edge clusterEdge = new Edge
                {
                    Edgetype = "Wurde Angesteckt mit ",
                    Source = element.PatientId,
                    Target = element.ResultId
                };
                clusterEdges.Add(clusterEdge);
            };
            return clusterEdges;
        }
        //public List<Edges> GetClusterRelationOrigin()
        //{
        //    Origin origin = new Origin();
        //    List<Origin> origins = new List<Origin>();
        //    origins = origin.GetAllOrigins();
        //    List<Edges> clusterOrigins = new List<Edges>();
        //    foreach (Origin element in origins)
        //    {
        //        Nodes clusterOrigin = new Nodes
        //        {
        //            Nodetype = "Angesteckt in ",
        //            Source = element.OriginId,
        //            Target = element.City         
        //        };
        //        clusterOrigins.Add(clusterOrigin);
        //    };
        //    return clusterOrigins;
        //}
    }
    
}
    
