using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using EVCB_OCPP.Packet.Utilities;
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 ChargingSchedule
    {
        /// <summary>
        /// Duration of the charging schedule in seconds.
        /// If the duration is left empty, the last period will continue indefinitely or 
        /// until end of the transaction in case startSchedule is absent.
        /// </summary>
        public int? duration { set; get; }

        /// <summary>
        /// Starting point of an absolute schedule.
        /// If absent the schedule will be relative to start of charging.
        /// </summary>
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime? startSchedule { set; get; }

        /// <summary>
        /// The unit of measure Limit is expressed in.
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public ChargingRateUnitType chargingRateUnit { set; get; }

        /// <summary>
        /// List of  ChargingSchedulePeriod elements defining
        ///maximum power or current usage over time.
        /// </summary>
        [Required]
        public List<ChargingSchedulePeriod> chargingSchedulePeriod { set; get; }

        /// <summary>
        /// Minimum  charging rate supported by the electric vehicle.
        ///The unit of measure is defined by the chargingRateUnit.
        ///This parameter is intended to be used by a local smart
        ///charging algorithm to optimize the power allocation for in the case
        ///a charging process is inefficient at lower charging rates.
        ///Accepts at most one digit fraction (e.g. 8.1)
        /// </summary>
        public decimal? minChargingRate { set; get; }


    }
}
