using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;

namespace EVCB_OCPP.WSServer
{

    class Program
    {
        static void Main(string[] args)
        {

            Dictionary<long, long> dictionary = new Dictionary<long, long>()
            {
                {  DateTimeOffset.Now.AddDays(-3).ToUnixTimeSeconds(),  DateTimeOffset.Now.ToUnixTimeSeconds()},
                {  DateTimeOffset.Now.AddDays(-2).ToUnixTimeSeconds(),  DateTimeOffset.Now.ToUnixTimeSeconds()},
                {  DateTimeOffset.Now.AddDays(-1).ToUnixTimeSeconds(),  DateTimeOffset.Now.ToUnixTimeSeconds()}

             };

          var ttt=   JsonConvert.SerializeObject(dictionary);


            Console.WriteLine("====================================================================================================");
            Console.WriteLine("====================================================================================================");
            Console.WriteLine("==                                                                                                ==");
            Console.WriteLine("==       ------------               -----------      -------------         -------------          ==");
            Console.WriteLine("==    ---            ---       ----                  ----------------      ----------------       ==");
            Console.WriteLine("==    ---            ---     ----                    ----            ---   ----            ---    ==");
            Console.WriteLine("==    ---            ---    ----                     ----            ---   ----            ---    ==");
            Console.WriteLine("==    ---            ---    ----                     ---- -------------    ---- -------------     ==");
            Console.WriteLine("==    ---            ---    ----                     ---- -----------      ---- -----------       ==");
            Console.WriteLine("==    ---            ---      ----                   ----                  ----                   ==");
            Console.WriteLine("==    ---            ---        ----                 ----                  ----                   ==");
            Console.WriteLine("==       -----------                -----------      ----                  ----                   ==");
            Console.WriteLine("==                                                                                                ==");
            Console.WriteLine("====================================================================================================");
            Console.WriteLine("====================================================================================================");
            ProtalServer s = new ProtalServer();
            Console.WriteLine("Starting Server...");
            s.Start();

            Console.Read();
        }

        public static object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            DateTime? timevalue = null;
            if (reader.Value != null)
            {
                DateTime date = ((DateTime)reader.Value).ToLocalTime();
                timevalue = new DateTime(date.Year, date.Month, date.Day, date.TimeOfDay.Hours, date.TimeOfDay.Minutes, date.TimeOfDay.Seconds, 000);
            }
            return timevalue;
        }
    }
}
