using EVCB_OCPP.Packet20.DataTypes.EnumTypes;
using EVCB_OCPP.Packet20.Utilites;
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.Packet20.DataTypes
{
    public class MessageInfoType
    {
        /// <summary>
        /// Master resource identifier, unique within an
        /// exchange context.It is defined within the OCPP context
        /// as a positive Integer value (greater or equal to zero).
        /// </summary>
        [Required]
        public int Id { set; get; }

        /// <summary>
        /// With what priority should this message be
        ///shown
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public MessagePriorityEnumType Priority { set; get; }

        /// <summary>
        /// During what state should this message be
        /// shown.When omitted this message should be shown in
        ///any state of the Charging Station.
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public MessageStateEnumType? State { set; get; }

        /// <summary>
        /// From what date-time should this message be
        /// shown.If omitted: directly.
        /// </summary>
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime? StartDateTime { set; get; }

        /// <summary>
        /// Until what date-time should this message be
        /// shown, after this date/time this message SHALL be
        ///removed.
        /// </summary>
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime? EndDateTime { set; get; }

        /// <summary>
        /// During which transaction shall this message be
        ///shown.Message SHALL be removed by the Charging
        /// Station after transaction has ended.
        /// </summary>
        [StringLength(36, MinimumLength = 0)]
        public string TransactionId { set; get; }

        /// <summary>
        /// Contains message details for the message to
        ///  be displayed on a Charging Station.
        /// </summary>
        [Required]
        public MessageContentType Message { set; get; }

        /// <summary>
        /// When a Charging Station has multiple Displays,
        ///this field can be used to define to which Display this
        /// message belongs.
        /// </summary>
        public ComponentType Display { set; get; }

    }
}
