using EVCB_OCPP.Packet.Features;
using EVCB_OCPP.Packet.Utilities;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EVCB_OCPP.Packet.Messages.Security
{
    public class SecurityEventNotificationRequest:IRequest
    {
        public SecurityEventNotificationRequest()
        {
            Action = Actions.SecurityEventNotification.ToString();
        }

        /// <summary>
        /// Type of the security event (See list of currently known security events)
        /// </summary>
        [Required]
        [StringLength(50,MinimumLength =0)]
        public string type { set; get; }

        /// <summary>
        /// Date and time at which the event occurred.
        /// </summary>
        [Required]
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime timestamp { set; get; }

        /// <summary>
        /// Additional information about the occurred security event.
        /// </summary>
        [Required]
        [StringLength(255, MinimumLength = 0)]
        public string techInfo { set; get; }

        [JsonIgnore]
        public string Action { set; get; }

        public bool TransactionRelated()
        {
            return false;
        }

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