using System;
using Toolbox.Docking.Api.Units;

namespace Toolbox.Docking.Api.Data
{
    /// <summary>
    /// Scalar data value definition object.
    /// </summary>
    [Serializable]
    public class TbScalarData
    {
        /// <summary>
        /// The unit of this data.
        /// </summary>
        public TbUnit Unit { get; }

        /// <summary>
        /// The value of this data.
        /// </summary>
        public double? Value { get; }

        /// <summary>
        /// Value qualifier.
        /// </summary>
        public TbDataQualifier Qualifier { get; }
        /// <summary>
        /// Cloned data constructor.
        /// </summary>
        /// <param name="data">Scalar to be cloned.</param>
        public TbScalarData(TbScalarData data)
        {
            Unit = data.Unit;
            Value = data.Value;
            Qualifier = data.Qualifier;
        }
        /// <summary>
        /// Unit and value constructor. 
        /// </summary>
        /// <param name="unit">Toolbox unit of the scalar value.</param>
        /// <param name="value">The value for the scalar.</param>
        public TbScalarData(TbUnit unit, double? value)
        {
            Unit = unit;
            Value = value;
            Qualifier = TbDataQualifier.None;
        }

        /// <summary>
        /// Toolbox scalar value constructor.
        /// </summary>
        /// <param name="unit">Toolbox unit of the scalar value.</param>
        /// <param name="value">The value for the scalar.</param>
        /// <param name="qualifier">Qualifier for the value.</param>
        public TbScalarData(TbUnit unit, double? value, TbDataQualifier qualifier)
        {
            Unit = unit;
            Value = value;
            Qualifier = qualifier;
        }
    }
}