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

using System;

using Volpe.Cafe.Generic;
using Volpe.Cafe.Logging;
using Volpe.Cafe.MarketData.Design;
using Volpe.Cafe.ModelSettings;

namespace Volpe.Cafe.DfsSrModels.DfsModels
{
    /// <inheritdoc cref="DfsModel.UserDefinedShares"/>
    [Serializable]
    public class UserDefinedShares : DfsModelBase
    {
        /// <summary>
        /// Initializes a new instances of the <see cref="UserDefinedShares"/> class, using the specified industry
        /// data, modeling settings, and log writer.
        /// </summary>
        /// <inheritdoc path="/param"/>
        /// <inheritdoc path="/exception"/>
        public UserDefinedShares(IIndustry data, ModelingSettings settings, ILogger logWriter)
            : base(data, settings, logWriter)
        {
            var carShares = settings.Parameters.DfsModelValues.StaticCarShares;
            this._fleetShares = carShares.ConvertAll(carShare => new FleetTypeValue(carShare, 1 - carShare, 1));
        }

        private IAnnualValue<FleetTypeValue> _fleetShares;

        public override AggregationMode PreferredAggregationMode => AggregationMode.ByBaselineRegClass;
        public override int NumberOfLaggedYears => 0;

        protected override FleetTypeValue CalcNewFleetSharesInternal(Scenario scen, int iteration, int year,
            AnnualValue<ForecastFleet> baseFleet, AnnualValue<ForecastFleet> scenFleet)
        {
            return this._fleetShares[year];
        }

    }
}
