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 ChargingProfileType
    {
        /// <summary>
        /// Id of ChargingProfile.
        /// </summary>
        [Required]
        public int Id { set; get; }

        /// <summary>
        /// Value 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 profile
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public ChargingProfilePurposeEnumType ChargingProfilePurpose { set; get; }

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

        /// <summary>
        /// Indicates the start point of a recurrence.
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public RecurrencyKindEnumType? 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 Charging Station.
        /// </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.
        /// </summary>
        [JsonConverter(typeof(UTCDateTimeConverter))]
        public DateTime? ValidTo { set; get; }

        /// <summary>
        /// SHALL only be included if
        /// ChargingProfilePurpose is set to TxProfile.The
        ///transactionId is used to match the profile to a specific
        ///transaction.
        /// </summary>
        [StringLength(36, MinimumLength = 0)]
        public string TransactionId { set; get; }

        /// <summary>
        /// Schedule that contains limits for the available
        /// power or current over time.In order to support ISO 15118
        ///schedule negotiation, it supports at most three schedules
        ///with associated tariff to choose from.
        /// </summary>
        [Required]
        public ChargingScheduleType ChargingSchedule { set; get; }
    }
}
