using EVCB_OCPP.Packet20.Utilites;
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.Packet20.DataTypes
{
    public class FirmwareType
    {
        /// <summary>
        /// URI defining the origin of the firmware.
        /// </summary>
        [Required]
        [StringLength(512, MinimumLength = 0)]
        public string Location { set; get; }

        /// <summary>
        /// Date and time at which the firmware shall be
        ///retrieved.
        /// </summary>
        [Required]
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime RetrieveDateTime { set; get; }

        /// <summary>
        /// Date and time at which the firmware shall be
        ///installed.
        /// </summary>     
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime? InstallDateTime { set; get; }

        /// <summary>
        /// Certificate with which the firmware was signed.
        ///  X.509 certificate, first DER encoded into binary, and then
        ///Base64 encoded.
        /// </summary>
        [StringLength(5500, MinimumLength = 0)]
        public string SigningCertificate { set; get; }

        /// <summary>
        /// Base64 encoded firmware signature.
        /// </summary>
        [StringLength(800, MinimumLength = 0)]
        public string Signature { set; get; }

    }
}
