using System;

namespace Volpe.Cafe.EffectsData
{
    /// <summary>
    /// Provides modeling effects related to various general vehicle attributes, which are not differentiated by
    /// vehicle age.
    /// </summary>
    [Serializable]
    public sealed class GeneralEffects : IAppendable
    {
        /// <summary>Gets or sets the total vehicle sales.</summary>
        public double Sales { get; set; }

        /// <summary>Gets or sets the average vehicle curb weight.</summary>
        public double CurbWeight { get; set; }
        /// <summary>Gets or sets the average vehicle footprint.</summary>
        public double Footprint { get; set; }
        /// <summary>Gets or sets the average vehicle work factor.</summary>
        public double WorkFactor { get; set; }

        /// <summary>
        /// Resets all general effects values to zero.
        /// </summary>
        public void Clear()
        {
            this.Sales = 0;
            this.CurbWeight = 0;
            this.Footprint = 0;
            this.WorkFactor = 0;
        }

        /// <summary>
        /// Appends all values from the specified <see cref="GeneralEffects"/> object to this instance.
        /// </summary>
        public void Append(GeneralEffects value)
        {
            this.Sales += value.Sales;
            this.CurbWeight += value.CurbWeight;
            this.Footprint += value.Footprint;
            this.WorkFactor += value.WorkFactor;
        }

        //----- explicit interface implementation -----
        void IAppendable.Append(IAppendable value)
        {
            this.Append((GeneralEffects)value);
        }

    }
}
