using EVCB_OCPP.Packet20.DataTypes.EnumTypes;
using EVCB_OCPP.Packet20.Utilites;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EVCB_OCPP.Packet20.Messages
{
    public class BootNotificationResponse:IConfirmation
    {
        /// <summary>
        /// This contains the CSMS’s current time.
        /// </summary>
        [Required]
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime CurrentTime { set; get; }

        /// <summary>
        /// When Status is Accepted, this contains the
        ///  heartbeat interval in seconds.If the CSMS returns
        ///something other than Accepted, the value of the interval
        ///field indicates the minimum wait time before sending a
        ///next BootNotification request.
        /// </summary>
        [Required]
        public int Interval { set; get; }

        /// <summary>
        /// This contains whether the Charging Station has
        /// been registered within the CSMS.
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public RegistrationStatusEnumType Status { set; get; }


        private IRequest _request = null;
        public IRequest GetRequest()
        {
            return _request;
        }

        public void SetRequest(IRequest request)
        {
            _request = request;
        }

        public bool Validate()
        {
            return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
        }
    }
}
