using EVCB_OCPP.Packet.Features;
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 CertificateSignedRequest:IRequest
    {
        public CertificateSignedRequest()
        {
            Action = Actions.CertificateSigned.ToString();
        }

        /// <summary>
        /// Required. The signed PEM encoded X.509 certificates. This can also contain the
        /// necessary sub CA certificates.The maximum size of this field is be limited by the
        /// configuration key: CertificateSignedMaxSize.
        /// </summary>
        [Required]
        [StringLength(10000, MinimumLength = 0)]
        public string certificateChain { 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);
        }
    }
}
