using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EHEC_Server;
using System.Web.Script.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Linq;

namespace EHEC_Server
{
    public class ClusterConverter
    {
        protected string Json { get; set; }
        public JObject WriteJson()
        {
            var serializer = new JsonSerializer
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            var Json = JObject.FromObject(GetCluster(), serializer);
            //ClusterPatient p = new ClusterPatient();
            //List<ClusterPatient> clusterPatientsList = new List<ClusterPatient>();
            //clusterPatientsList = p.GetClusterPatients();
            //ClusterResult r = new ClusterResult();
            //List<ClusterResult> clusterResultsList = new List<ClusterResult>();
            //clusterResultsList = r.GetClusterResults();
            System.IO.File.WriteAllText(@"C: \Users\novski\Desktop\cluster.json", JsonConvert.SerializeObject(Json));
            return Json; //= JsonConverter.Serialize(clusterPatientsList);
            
        }
        private ClusterModel GetCluster()
        {
            Node node = new Node();
            Edge edge = new Edge();
            return new ClusterModel
            {
                Comment = "some comment",
                Nodes = node.GetNodes(),
                Edges = edge.GetEdges(),

            };
        }
    }
}