using EVCB_OCPP.Packet.Features;
using EVCB_OCPP.Packet.Messages;
using OCPPServer.Protocol;
using System;
using Microsoft.Extensions.Logging;

namespace EVCB_OCPP.WSServer.Message
{
    internal partial class ProfileHandler
    {
        internal MessageResult ExecuteSecurityRequest(Actions action, ClientData session, IRequest request)
        {
            MessageResult result = new MessageResult() { Success = false };

            try
            {
                switch (action)
                {


                    default:
                        {
                            Console.WriteLine(string.Format("Not Implement {0} Logic(ExecuteCoreRequest)", request.GetType().ToString().Replace("OCPPPackage.Messages.Core.", "")));
                        }
                        break;
                }
            }
            catch (Exception ex)
            {
                logger.LogCritical("chargeBoxId:{0} {1}", session.ChargeBoxId, action);
                logger.LogCritical("Data {0}", request.ToString());
                logger.LogCritical("Error {0}", ex.ToString());
                result.Exception = ex;
            }



            return result;
        }
        internal MessageResult ExecuteSecurityConfirm(Actions action, ClientData session, IConfirmation confirm, string requestId)
        {
            MessageResult result = new MessageResult() { Success = false };

            switch (action)
            {

                default:
                    {
                        Console.WriteLine(string.Format("Not Implement {0} Logic", confirm.GetType().ToString().Replace("OCPPPackage.Messages.RemoteTrigger.", "")));
                    }
                    break;
            }
            return result;
        }


        internal MessageResult ReceivedSecurityError(Actions action, string errorMsg, ClientData session, string requestId)
        {
            MessageResult result = new MessageResult() { Success = true };

            switch (action)
            {

                default:
                    {
                        Console.WriteLine(string.Format("Not Implement {0} Logic", action));
                    }
                    break;
            }
            return result;

        }
    }
}
