using System;

namespace Elwig.Helpers.Weighing {
    /// <summary>
    /// Result of a weighing process on an industrial scale
    /// </summary>
    public class WeighingResult {
        /// <summary>
        /// Measured net weight in kg
        /// </summary>
        public int? Weight = null;

        /// <summary>
        /// Weighing id (or IdentNr) provided by the scale
        /// </summary>
        public string? WeighingId = null;

        /// <summary>
        /// Wheighing id (or IdentNr) provided by the scale optionally combined with the current date
        /// </summary>
        public string? FullWeighingId = null;

        /// <summary>
        /// Date string provided by the scale
        /// </summary>
        public DateOnly? Date = null;

        /// <summary>
        /// Time string provided by the scale
        /// </summary>
        public TimeOnly? Time = null;

        /// <returns>&lt;Weight/WeighingId/Date/Time&gt;</returns>
        override public string ToString() {
            var w = Weight != null ? $"{Weight}kg" : "";
            return $"<{w}/{WeighingId}/{Date:yyyy-MM-dd}/{Time:HH:mm}>";
        }
    }
}