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.Text;
using System.Threading.Tasks;

namespace EVCB_OCPP.Packet20.DataTypes
{
    public class VariableAttributeType
    {
        /// <summary>
        /// Attribute: Actual, MinSet, MaxSet, etc. Defaults
        ///to Actual if absent.
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public AttributeEnumType? Type { set; get; }

        /// <summary>
        /// Value of the attribute. May only be omitted
        /// when mutability is set to 'WriteOnly'.
        ///The Configuration Variable ReportingValueSize can be
        ///used to limit GetVariableResult.attributeValue,
        ///VariableAttribute.value and EventData.actualValue.
        /// </summary>
        [StringLength(2500, MinimumLength = 0)]
        public string Value { set; get; }

        /// <summary>
        /// Defines the mutability of this attribute. Default
        ///is ReadWrite when omitted.
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public MutabilityEnumType? Mutability { set; get; }

        /// <summary>
        /// If true, value will be persistent across system
        /// reboots or power down.Default when omitted is false
        /// </summary>
        public bool? Persistent { set; get; }

        /// <summary>
        /// If true, value that will never be changed by the
        ///  Charging Station at runtime.Default when omitted is
        ///false.
        /// </summary>
        public bool? Constant { set; get; }

    }
}
