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 SampledValueType
    {
        /// <summary>
        /// Indicates the measured value.
        /// </summary>
        [Required]
        public decimal Value { set; get; }

        /// <summary>
        /// Type of detail value: start, end or sample.
        /// Default = "Sample.Periodic"
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public ReadingContextEnumType? Context { set; get; }

        /// <summary>
        /// Type of measurement. Default =
        ///"Energy.Active.Import.Register"
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public MeasurandEnumType? Measurand { set; get; }

        /// <summary>
        /// Indicates how the measured value is to be
        ///interpreted.For instance between L1 and neutral(L1-N)
        ///Please note that not all values of phase are applicable to
        ///all Measurands.When phase is absent, the measured
        ///value is interpreted as an overall value.
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public PhaseEnumType? Phase { set; get; }

        /// <summary>
        /// Indicates where the measured value has been
        ///sampled.Default = "Outlet"
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public LocationEnumType? Location { set; get; }

        /// <summary>
        /// Contains the MeterValueSignature with
        ///sign/encoding method information.
        /// </summary>     
        public SignedMeterValueType SignedMeterValue { set; get; }

        /// <summary>
        /// Represents a UnitOfMeasure including a
        /// multiplier
        /// </summary>
        public UnitOfMeasureType UnitOfMeasure { set; get; }

    }
}
