using EVCB_OCPP.WEBAPI.Models.WebAPI;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

namespace EVCB_OCPP.WEBAPI.Handlers
{
    //public class GlobalExceptionHandler: ExceptionHandler
    //{
        

    //    public override void Handle(ExceptionHandlerContext context)
    //    {
           
    //        if (ShouldHandle(context))
    //        {
            
    //            context.Result = new TextPlainErrorResult() { Request = context.Request  };
    //        }
    //    }


    //    private class TextPlainErrorResult : IActionResult
    //    {
    //        public HttpRequestMessage Request { get; set; }

    //        public Task ExecuteResultAsync(ActionContext context)
    //        {
    //            var result = new CPOOuterResponse() { StatusMessage = CPO_StatusMessage.ERROR_MSG_Global_UNEXPECTEDERROR, StatusCode = (int)CPO_StatusCode.UnexpectedError };

    //            var resultString = JsonConvert.SerializeObject(result, EVCBConfiguration.JSONSERIALIZER_FORMAT);
    //            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.InternalServerError, result);
    //            response.RequestMessage = Request;
    //            return Task.FromResult(response);
    //        }
    //    }


    //}
}