using System;

namespace Volpe.Cafe.CreditBank
{
    /// <summary>
    /// Defines the amount of credit stored in a credit bank for each compliance category.
    /// <br/>
    /// Each compliance category is defined for a combination of: manufacturer, model year, and regulatory class.
    /// </summary>
    [Serializable]
    public struct CreditValue
    {
        /// <summary>
        /// Initializes a new <see cref="CreditValue"/> instance, using the specified amount, year of availability, and
        /// year of expiration.
        /// </summary>
        /// <param name="amount">The amount of credit stored in a credit bank.</param>
        /// <param name="yearAvailable">The earliest model year when this credit value is available for use.</param>
        /// <param name="yearExpires">The latest model year when this credit value is available for use.</param>
        public CreditValue(double amount, int yearAvailable, int yearExpires)
        {
            this.Amount = amount;
            this.YearAvailable = yearAvailable;
            this.YearExpires = yearExpires;
        }

        /// <summary>Gets an empty <see cref="CreditValue"/> instance.</summary>
        public static CreditValue Empty => new CreditValue(0, 0, 0);

        /// <summary>Gets or sets the amount of credit stored in a credit bank.</summary>
        public double Amount { get; set; }
        /// <summary>Gets the earliest model year when this credit value is available for use.</summary>
        public int YearAvailable { get; }
        /// <summary>Gets the latest model year when this credit value is available for use.</summary>
        public int YearExpires { get; }

    }
}
