using EVCB_OCPP.Packet20.DataTypes.EnumTypes;
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 ChargingScheduleType
    {
        /// <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>
        /// 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>
        /// The unit of measure Limit is expressed in.
        /// </summary>
        [Required]
        public ChargingRateUnitEnumType ChargingRateUnit { set; get; }

        /// <summary>
        /// Minimum charging rate supported by the EV.
        /// 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; }

        /// <summary>
        /// Identifies the ChargingSchedule.
        /// </summary>
        [Required]
        public int Id { set; get; }

        /// <summary>
        /// List of ChargingSchedulePeriod elements
        ///  defining maximum power or current usage over time.The
        ///  maximum number of periods, that is supported by the
        ///  Charging Station, if less than 1024, is set by device model
        ///  variable SmartChargingCtrlr.PeriodsPerSchedule.
        /// </summary>
        [Required]
        public List<ChargingSchedulePeriodType> ChargingSchedulePeriod { set; get; }

        /// <summary>
        /// Sales tariff associated with this charging
        /// schedule.
        /// </summary>
        public SalesTariffType SalesTariff { set; get; }



    }
}
