#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;

using Volpe.Cafe.Generic;
using Volpe.Cafe.MarketData.BaselineInfo;
using Volpe.Cafe.MarketData.Design;

using TechKey = Volpe.Cafe.TechKeys.TechKey128;

namespace Volpe.Cafe.MarketData
{
    /// <summary>
    /// Represents a revision of manufacturer's compliance attributes for a specific model year.
    /// </summary>
    /// <seealso cref="MarketData.Manufacturer"/>
    [Serializable]
    public class ManufacturerRevision : IManufacturerRevision
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ManufacturerRevision"/> class for the specified model year and
        /// <see cref="IManufacturer"/>.
        /// </summary>
        /// <param name="year">The model year associated with this manufacturer revision.</param>
        /// <param name="mfr">
        ///     The underlying <see cref="IManufacturer"/> associated with this manufacturer revision.
        /// </param>
        public ManufacturerRevision(int year, IManufacturer mfr)
        {
            this.RevisionYear = year;
            this.Manufacturer = mfr;

            this.ComplianceStats = new ComplianceStatistics();
            this.ComplianceCosts = new RCValue<ComplianceCosts>(() => new ComplianceCosts());
            this.InitAuxiliaryHevCosts = new RCValue<AuxiliaryHEVCosts>(() => new AuxiliaryHEVCosts());
            this.AuxiliaryHevCosts = new RCValue<AuxiliaryHEVCosts>(() => new AuxiliaryHEVCosts());

            this.TechAppliedSales = new double[TechnologyIndexes.TechnologyCount];
            this.TechExhausted = TechKey.Empty;
        }

        public IManufacturer Manufacturer { get; }
        public BaselineManufacturer BaselineInfo => this.Manufacturer.BaselineInfo;
        public int RevisionYear { get; }

        public int Code => this.BaselineInfo.Code;
        public string Name => this.BaselineInfo.Name;
        public string ProperName => this.BaselineInfo.ProperName;

        //----- values updated once at start of model year -----
        public PseudoFuelCost PseudoFuelCost { get; set; }

        //----- values updated throughout the model year -----
        public ComplianceStatistics ComplianceStats { get; set; }
        public double[] TechAppliedSales { get; set; }
        public TechKey TechExhausted { get; set; }

        //----- values updated at end of model year -----
        public RCValue<ComplianceCosts> ComplianceCosts { get; set; }
        public RCValue<AuxiliaryHEVCosts> InitAuxiliaryHevCosts { get; set; }
        public RCValue<AuxiliaryHEVCosts> AuxiliaryHevCosts { get; set; }

    }
}
