using EVCB_OCPP.Packet20.DataTypes.EnumTypes;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime;
using System.Text;
using System.Threading.Tasks;

namespace EVCB_OCPP.Packet20.DataTypes
{
    public class VariableCharacteristicsType
    {
        /// <summary>
        /// Unit of the variable. When the transmitted value
        /// has a unit, this field SHALL be included.
        /// </summary>
        [StringLength(16, MinimumLength = 0)]
        public string Unit { set; get; }

        /// <summary>
        /// Data type of this variable.
        /// </summary>
        [Required]
        [JsonConverter(typeof(StringEnumConverter))]
        public DataEnumType DataType { set; get; }

        /// <summary>
        /// Minimum possible value of this variable
        /// </summary>
        public decimal? MinLimit { set; get; }

        /// <summary>
        /// Maximum possible value of this variable. When
        ///the datatype of this Variable is String, OptionList,
        ///SequenceList or MemberList, this field defines the
        /// maximum length of the (CSV) string.
        /// </summary>
        public decimal? MaxLimit { set; get; }

        /// <summary>
        /// Allowed values when variable is
        /// Option/Member/SequenceList.
        /// * OptionList: The(Actual) Variable value must be a single
        ///value from the reported(CSV) enumeration list.
        ///* MemberList: The (Actual) Variable value may be an
        ///(unordered) (sub-)set of the reported(CSV) valid values
        ///list.
        ///* SequenceList: The(Actual) Variable value may be an
        ///ordered(priority, etc) (sub-)set of the reported(CSV) valid
        ///values.
        ///This is a comma separated list.
        ///The Configuration Variable ConfigurationValueSize can
        ///be used to limit SetVariableData.attributeValue and
        ///VariableCharacteristics.valueList.The max size of these
        ///values will always remain equal.
        /// </summary>
        [StringLength(1000, MinimumLength = 0)]
        public string ValuesList { set; get; }

        /// <summary>
        /// Flag indicating if this variable supports
        /// monitoring.
        /// </summary>
        [Required]
        public bool SupportsMonitoring { set; get; }
    }
}
