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 SignCertificateRequest : IRequest
    {
        public SignCertificateRequest()
        {
            Action = Actions.SignCertificate.ToString();
        }

        /// <summary>
        /// The Charge Point SHALL send the public key in form of a Certificate
        /// Signing Request(CSR) as described in RFC 2986 [14] and then PEM encoded,
        ////using the SignCertificate.req message.
        /// </summary>
        [Required]
        [StringLength(5500, MinimumLength = 0)]
        public string csr { 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);
        }
    }
}