using EVCB_OCPP.Packet.Utilities;
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.SubTypes
{
    public class csChargingProfiles
    {
        /// <summary>
        /// Unique identifier for this Profile.
        /// </summary>
        [Required]
        public int chargingProfileId { set; get; }

        /// <summary>
        /// 交易 id
        /// </summary>
        public int? transactionId { set; get; }

        /// <summary>
        /// determining level in  hierarchy stack of profiles.
        /// Higher values have precedence over lower values. 
        /// Lowest  level is 0.
        /// </summary>
        [Required]
        public int stackLevel { set; get; }

        /// <summary>
        /// Defines the purpose of the schedule transferred by this message.
        /// </summary>
        [Required]       
        [JsonConverter(typeof(StringEnumConverter))]
        public ChargingProfilePurposeType chargingProfilePurpose { set; get; }

        /// <summary>
        /// Indicates the kind of schedule.
        /// </summary>
        [Required]      
        [JsonConverter(typeof(StringEnumConverter))]
        public ChargingProfileKindType chargingProfileKind { set; get; }


        /// <summary>
        /// Indicates the start point of a recurrence.
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public RecurrencyKindType? recurrencyKind { set; get; }

        /// <summary>
        /// Point in time at which the profile starts to be valid.
        /// If absent, the profile is valid as soon as it is received by the Charge Point.
        /// Not to be used when ChargingProfilePurpose is TxProfile.
        /// </summary>
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime? validFrom { set; get; }

        /// <summary>
        /// Point in time at which the profile stops to be valid.
        /// If absent, the profile is valid until it is replaced by another profile. 
        /// Not to be used when ChargingProfilePurpose is TxProfile.
        /// </summary>
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime? validTo { set; get; }

        /// <summary>
        /// Contains limits for the available power or current overtime.
        /// </summary>
        [Required]
        public ChargingSchedule chargingSchedule { set; get; }
    }
}
