using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace UpsilonLanguageServer
{
    public static class Utility
    {
        public static readonly JsonSerializer CamelCaseJsonSerializer = new JsonSerializer
        {
            ContractResolver = new CamelCasePropertyNamesContractResolver()
        };

        public static string GetTimeStamp()
        {
            return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
        }

        public static async Task WaitForDocumentBound(this SessionDocument doc)
        {
            while (doc.IsChanging)
            {
                await Task.Delay(20);
            }
        }
    }
}