using EVCB_OCPP.Packet.Features;
using EVCB_OCPP.Packet.Messages.SubTypes;
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.Packet.Messages.Security
{
    public class ExtendedTriggerMessageRequest:IRequest
    {
        public ExtendedTriggerMessageRequest()
        {
            Action = Actions.ExtendedTriggerMessage.ToString();
        }

        /// <summary>
        /// Required. Type of the message to be triggered
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public MessageTriggerEnumType requestedMessage { set; get; }

        /// <summary>
        /// Only filled in when request applies to a specific connector.
        /// </summary>
        public int connectorId { 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);
        }
    }
}
