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 SignedFirmwareStatusNotificationRequest: IRequest
    {

        public SignedFirmwareStatusNotificationRequest()
        {
            Action = Actions.SignedFirmwareStatusNotification.ToString();
        }
        /// <summary>
        /// This contains the progress status of the firmware installation.
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public FirmwareStatusEnumType status { set; get; }

        /// <summary>
        /// The request id that was provided in the SignedUpdateFirmware.req
       /// that started this firmware update.This field is mandatory, unless the message
       /// was triggered by a TriggerMessage.req or the ExtendedTriggerMessage.req AND
        ///there is no firmware update ongoing
        /// </summary>
        public int requestId { 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);
        }
    }
}