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 StatusNotificationRequest:IRequest
    {
        /// <summary>
        /// The time for which the status is reported. If
        ///absent time of receipt of the message will be assumed.
        /// </summary>
        [Required]
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime Timestamp { set; get; }

        /// <summary>
        /// This contains the current status of the
        /// Connector.
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public ConnectorStatusEnumType ConnectorStatus { set; get; }

        /// <summary>
        /// The id of the EVSE to which the connector
        /// belongs for which the the status is reported.
        /// </summary>
        [Required]
        public int EvseId { set; get; }

        /// <summary>
        /// The id of the connector within the EVSE for
        ///  which the status is reported.
        /// </summary>
        [Required]
        public int ConnectorId { set; get; }
        public string Action { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

        public bool TransactionRelated()
        {
            return false;
        }

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