using System;
using System.Collections.Generic;
using Volpe.Cafe.MarketData.Design;
using Volpe.Cafe.ModelSettings;

namespace Volpe.Cafe.Reporting.Generators
{
    /// <summary>
    /// Defines an enumerable object used for generating rows of data for a platforms report.
    /// </summary>
    [Serializable]
    public class PlatformsReportDataGenerator : ComponentReportDataGeneratorBase<IPlatform>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PlatformsReportDataGenerator"/> class, for the specified
        /// scenario and reporting data.
        /// </summary>
        /// <inheritdoc cref="ReportDataGenerator(Scenario, ReportingData, ModelingSettings)" path="/param"/>
        public PlatformsReportDataGenerator(Scenario scen, ReportingData data, ModelingSettings settings)
            : base(scen, data, settings) { }

        /// <inheritdoc/>
        protected override IReadOnlyList<IPlatform> GetComponentList(IManufacturer mfr)
        {
            return mfr.Platforms;
        }

        /// <inheritdoc/>
        protected override string GetComponentTypeString(IPlatform component, List<IVehicleRevision> vehs)
        {
            return component.ComponentName;
        }

        /// <inheritdoc/>
        protected override IOEMComponentRevision GetComponentRevision(IPlatform component, IVehicle veh, int year)
        {
            return (component.Code == veh.GetRevision(year).PlatformCode)
                ? veh.GetPlatformRevision(year)
                : null;
        }

    }
}
