using System;
using Volpe.Cafe.Generic;

namespace Volpe.Cafe
{
    /// <summary>
    /// Represents an object that stores modeling data, as <see cref="PetroleumCategoryValue"/>s, for each pollutant.
    /// <br/>
    /// This object supports and operates on all pollutants as defined by <see cref="Pollutants.List"/>.
    /// </summary>
    [Serializable]
    public class UpstreamEmissionsValue : PollutantValue<PetroleumCategoryValue>, ICloneable
    {
        #region <<< Constructors >>>

        /// <summary>
        /// Initializes a new instance of the <see cref="UpstreamEmissionsValue"/> class.
        /// </summary>
        public UpstreamEmissionsValue() : this(0) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="UpstreamEmissionsValue"/> class using the specified initial
        /// value for all members.
        /// </summary>
        UpstreamEmissionsValue(double initialValue) : base(() => new PetroleumCategoryValue(initialValue)) { }

        #endregion

        #region <<< Properties >>>

        /// <summary>Gets the <see cref="UpstreamEmissionsValue"/> whose elements are all 0.</summary>
        public static UpstreamEmissionsValue Zero => new UpstreamEmissionsValue(0D);
        /// <summary>Gets the <see cref="EmissionsValue"/> whose elements are all 1.</summary>
        public static UpstreamEmissionsValue One => new UpstreamEmissionsValue(1D);

        #endregion

        #region <<< Methods >>>

        #region < ICloneable Members >

        /// <summary>
        /// Creates a new object that is a copy of the current <see cref="UpstreamEmissionsValue"/> instance.
        /// </summary>
        /// <returns>A new object that is a copy of this <see cref="UpstreamEmissionsValue"/>.</returns>
        object ICloneable.Clone()
        {
            return this.Clone();
        }
        /// <summary>
        /// Creates a copy of the current <see cref="UpstreamEmissionsValue"/> instance.
        /// </summary>
        /// <returns>A new object that is a copy of this <see cref="UpstreamEmissionsValue"/>.</returns>
        public new UpstreamEmissionsValue Clone()
        {
            var value = new UpstreamEmissionsValue();
            this.CloneInternal(this, value, item => item.Clone());
            return value;
        }

        #endregion

        /// <summary>
        /// Resets all members of this instance to their default values (0).
        /// </summary>
        public void Clear()
        {
            base.Clear(item => item.Clear());
        }

        #endregion
    }
}
