using System;
using System.Threading.Tasks;

namespace Elwig.Helpers.Weighing {
    /// <summary>
    /// Interface for controlling a industrial scale
    /// </summary>
    public interface IScale : IDisposable {
        /// <summary>
        /// Manufacturer of the scale
        /// </summary>
        string Manufacturer { get; }

        /// <summary>
        /// Model of the scale
        /// </summary>
        string Model { get; }

        /// <summary>
        /// Unique number of the scale
        /// </summary>
        int ScaleNr { get; }

        /// <summary>
        /// Internal identifying number of the scale in its system
        /// </summary>
        int InternalScaleNr { get; }

        /// <summary>
        /// Indicates if the scale is currently processing a request or not
        /// </summary>
        bool IsReady { get; }

        /// <summary>
        /// Indicates if the the clearance for filling the scale container has been granted
        /// </summary>
        bool HasFillingClearance { get; }

        /// <summary>
        /// The maximal configured weight limit of the scale in kg
        /// </summary>
        int? WeightLimit { get; }

        /// <summary>
        /// Get the current weight on the scale without performing a weighing process
        /// </summary>
        /// <returns>Result of the weighing process (probably without a weighing id)</returns>
        Task<WeighingResult> GetCurrentWeight();

        /// <summary>
        /// Perform a weighing process
        /// </summary>
        /// <returns>Result of the weighing process (including a weighing id)</returns>
        Task<WeighingResult> Weigh();

        /// <summary>
        /// Empty the scale container or grant clearance to do so
        /// </summary>
        Task Empty();

        /// <summary>
        /// Grant clearance to fill the scale container
        /// </summary>
        Task GrantFillingClearance();

        /// <summary>
        /// Revoke clearance to fill the scale container
        /// </summary>
        Task RevokeFillingClearance();
    }
}