using System;
using System.Collections.Generic;
using Volpe.Cafe.Initializers;

namespace Volpe.Cafe.ModelSettings
{
    /// <summary>
    /// Defines compliance scenario attributes for a single regulatory class and model year.
    /// </summary>
    [Serializable]
    public class ScenarioInfo
    {
        #region <<< Constructors >>>

        /// <summary>
        /// Initializes a new instance of the <see cref="ScenarioInfo"/> class.
        /// </summary>
        public ScenarioInfo(Dictionary<string, object> values)
        {
            DataObjectInitializer.SetPropertyValues(this, values);

            // calc additional read-only properties not defined in the values dict
            this.MaxOffCycleCaps = new OffCycleValues(
                Math.Max(this.OffCycleCafeCaps.AcEfficiency, this.OffCycleCO2Caps.AcEfficiency),
                Math.Max(this.OffCycleCafeCaps.AcLeakage, this.OffCycleCO2Caps.AcLeakage),
                Math.Max(this.OffCycleCafeCaps.OffCycle, this.OffCycleCO2Caps.OffCycle),
                fullSizePickup: 0);
            this.MaxOffCycleBevCaps = new OffCycleValues(
                Math.Max(this.OffCycleCafeBevCaps.AcEfficiency, this.OffCycleCO2BevCaps.AcEfficiency),
                Math.Max(this.OffCycleCafeBevCaps.AcLeakage, this.OffCycleCO2BevCaps.AcLeakage),
                Math.Max(this.OffCycleCafeBevCaps.OffCycle, this.OffCycleCO2BevCaps.OffCycle),
                fullSizePickup: 0);
        }

        #endregion

        #region <<< Properties >>>

        //----- informational values for diagnostic/debugging purposes -----
        /// <summary>
        /// Gets the <see cref="RegulatoryClass"/> for which the compliance scenario attributes are defined.
        /// </summary>
        public RegulatoryClass RegClass { get; private set; }
        /// <summary>Gets the model year for which the compliance scenario attributes are defined.</summary>
        public int ModelYear { get; private set; }

        //----- CAFE standards -----
        /// <summary>Gets the functional form to use for computing the vehicle's fuel economy target.</summary>
        public int Function { get; private set; }
        /// <summary>
        /// Gets the coefficients associated with the functional form to use for computing the vehicle's fuel economy
        /// target.
        /// </summary>
        public double[] Coefficients { get; private set; }

        /// <summary>
        /// Gets the minimum CAFE standard that each manufacturer must attain, specified as a flat-standard in
        /// miles/gallon, or 0 if not applicable.
        /// </summary>
        public double MinStndMpg { get; private set; }
        /// <summary>
        /// Gets the minimum CAFE standard that each manufacturer must attain, specified as a percentage of the average
        /// requirement under the function-based standard, or 0 if not applicable.
        /// </summary>
        public double MinStndPct { get; private set; }

        //----- CO2 standards -----
        /// <summary>Gets the functional form to use for computing the vehicle's CO-2 target.</summary>
        public int CO2Function { get; private set; }
        /// <summary>
        /// Gets the coefficients associated with the functional form to use for computing the vehicle's CO-2 target.
        /// </summary>
        public double[] CO2Coefficients { get; private set; }

        /// <summary>
        /// Gets the CO-2 factor to use for converting between fuel economy targets and CO-2 targets.
        /// </summary>
        public double CO2Factor { get; private set; }
        /// <summary>
        /// Gets the absolute amount (in grams/mile) by which to shift the CO-2 targets after conversion from fuel
        /// economy.
        /// </summary>
        public double CO2Offset { get; private set; }

        /// <summary>
        /// Gets whether to include upstream emissions when calculating the CO-2 rating for electricity and hydrogen
        /// fuel types.
        /// </summary>
        public bool CO2IncludeUpstream { get; private set; }

        /// <summary>
        /// Gets the production multiplier, used to scale the sales volumes of CNGs and PHEVs when computing a
        /// manufacturer's CO-2 standard and rating when evaluating compliance under EPA's CO-2 program.
        /// </summary>
        public double EpaMultiplier1 { get; private set; }
        /// <summary>
        /// Gets the production multiplier, used to scale the sales volumes of BEVs and FCVs when computing a
        /// manufacturer's CO-2 standard and rating when evaluating compliance under EPA's CO-2 program.
        /// </summary>
        public double EpaMultiplier2 { get; private set; }

        //----- misc settings for standards -----
        /// <summary>Gets whether new standards are being set during a given year.</summary>
        public bool StandardSettingYear { get; private set; }

        //----- fine rate and credit value -----
        /// <summary>
        /// Gets the CAFE fine rate (in $/credit) applicable when a manufacturer's fleet is under compliance.
        /// </summary>
        /// <remarks>
        /// The denomination of the "credit" in $/credit varies depending on the regulatory-class being evaluated. For
        /// light-duty vehicles (those regulated as passenger cars or light trucks), one credit is equal to one-tenth
        /// of a vehicle mpg. For HDPUV vehicles, one credit is equal to one gallon of fuel.
        /// </remarks>
        public double FineRate { get; private set; }
        /// <summary>Gets the value of a single CAFE credit (in $/credit).</summary>
        public double CreditValue { get; private set; }
        /// <summary>Gets the value of a single CO-2 credit (in $/credit).</summary>
        public double CO2CreditValue { get; private set; }

        //----- multi-fuel applicability -----
        /// <summary>
        /// Gets the applicability of multi-fuel vehicles for compliance calculations (does not apply to single-fuel
        /// vehicles). The following modes are available:<br/>
        /// <br/>
        /// <b>0</b>: only gasoline fuel economy value is considered (gasoline fuel share is assumed to be 100%);<br/>
        /// <b>1</b>: for Gasoline/Ethanol-85 vehicles, only the gasoline fuel economy value is considered (gasoline
        ///     fuel share is assumed to be 100%); for Gasoline/Electricity vehicles, both fuel economy values are
        ///     considered;<br/>
        /// <b>2</b>: for Gasoline/Ethanol-85 and Gasoline/Electricity vehicles, both fuel economy values are
        ///     considered.
        /// </summary>
        public int MultiFuel { get; private set; }
        /// <summary>
        /// Gets whether to exclude the electricity component from PHEVs for effects calculations.
        /// </summary>
        public bool NonElectricPhevsInEffects { get; private set; }
        /// <summary>
        /// Gets the fuel share to use for compliance purposes for flex-fuel vehicles (FFVs), whenever the
        /// <see cref="MultiFuel"/> mode is <b>2</b>. This fuel share applies only to vehicles that operate on gasoline
        /// and E85 fuel types. The maximum of this setting and the vehicle's assumed on-road fuel share will be used
        /// for compliance.
        /// </summary>
        public double MultiFuelShareFfv { get; private set; }
        /// <summary>
        /// Gets the fuel share to use for compliance purposes for plug-in hybrid/electric vehicles (PHEVs), whenever
        /// the <see cref="MultiFuel"/> mode is either <b>1</b> or <b>2</b>. This fuel share applies only to vehicles
        /// that operate on gasoline and electricity fuel types. The maximum of this setting and the vehicle's assumed
        /// on-road fuel share will be used for compliance.
        /// </summary>
        public double MultiFuelSharePhev { get; private set; }

        //----- PEFs -----
        /// <summary>
        /// Gets whether the petroleum equivalence factors (PEFs) are applicable during a given year, for vehicles that
        /// operate on electricity (i.e., PHEVs and BEVs).
        /// </summary>
        public bool ApplyPef { get; private set; }
        /// <summary>
        /// Gets the petroleum equivalence factor (PEF), specified in W-h/gallon, applicable to the battery electric
        /// vehicles (BEVs).
        /// </summary>
        public double PefBev { get; private set; }
        /// <summary>
        /// Gets the petroleum equivalence factor (PEF), specified in W-h/gallon, applicable to the plug-in
        /// hybrid/electric vehicles (PHEVs).
        /// </summary>
        public double PefPhev { get; private set; }

        //----- AC/off-cycle credit caps and costs -----
        /// <summary>
        /// Gets the maximum amounts (or "caps") for various credits and adjustments that a manufacturer may claim
        /// toward compliance with NHTSA's CAFE standards for non-battery-electric vehicles (non-BEVs). The caps are
        /// specified in grams/mile of CO-2.
        /// </summary>
        public OffCycleValues OffCycleCafeCaps { get; private set; }
        /// <summary>
        /// Gets the maximum amounts (or "caps") for various credits and adjustments that a manufacturer may claim
        /// toward compliance with NHTSA's CAFE standards for battery-electric vehicles (BEVs). The caps are specified
        /// in grams/mile of CO-2.
        /// </summary>
        public OffCycleValues OffCycleCafeBevCaps { get; private set; }

        /// <summary>
        /// Gets the maximum amounts (or "caps") for various credits and adjustments that a manufacturer may claim
        /// toward compliance with EPA's CO-2 standards for non-battery-electric vehicles (non-BEVs). The caps are
        /// specified in grams/mile of CO-2.
        /// </summary>
        public OffCycleValues OffCycleCO2Caps { get; private set; }
        /// <summary>
        /// Gets the maximum amounts (or "caps") for various credits and adjustments that a manufacturer may claim
        /// toward compliance with EPA's CO-2 standards for battery-electric vehicles (BEVs). The caps are specified in
        /// grams/mile of CO-2.
        /// </summary>
        public OffCycleValues OffCycleCO2BevCaps { get; private set; }

        /// <summary>
        /// Gets the maximum of each cap between the <see cref="OffCycleCafeCaps"/> and <see cref="OffCycleCO2Caps"/>.
        /// </summary>
        public OffCycleValues MaxOffCycleCaps { get; } // auto-calc in ctor
        /// <summary>
        /// Gets the maximum of each cap between the <see cref="OffCycleCafeBevCaps"/> and
        /// <see cref="OffCycleCO2BevCaps"/>.
        /// </summary>
        public OffCycleValues MaxOffCycleBevCaps { get; } // auto-calc in ctor

        /// <summary>
        /// Gets the estimated cost of each off-cycle credit value (AC Efficiency, AC Leakage, and various other
        /// "off-cycle" technologies) that a manufacturer claims toward compliance. Each of the off-cycle cost values
        /// is specified in $/credit, where each credit is in turn denominated in grams/mile of CO-2.
        /// </summary>
        public OffCycleValues OffCycleCosts { get; private set; }

        //----- tax credits ($) -----
        /// <summary>
        /// Gets the maximum amount of vehicle tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// strong hybrid/electric vehicle (SHEV).
        /// </summary>
        public double TaxCreditShev { get; private set; }
        /// <summary>
        /// Gets the maximum amount of vehicle tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// plug-in hybrid/electric vehicle (PHEV).
        /// </summary>
        public double TaxCreditPhev { get; private set; }
        /// <summary>
        /// Gets the maximum amount of vehicle tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// battery electric vehicle (BEV).
        /// </summary>
        public double TaxCreditBev { get; private set; }
        /// <summary>
        /// Gets the maximum amount of vehicle tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// fuel cell vehicle (FCV).
        /// </summary>
        public double TaxCreditFcv { get; private set; }

        /// <summary>
        /// Gets the amount by which to scale the vehicle tax credits attributed to the purchase of a hybrid/electric
        /// vehicle. 
        /// </summary>
        /// <remarks>
        /// The tax credit scale is defined from the consumer's perspective, which results in the amount of vehicle tax
        /// credits claimed by a vehicle buyer. Conversely, the inverse of the scale (i.e., 1 - scale) is defined from
        /// the manufacturer's perspective, which results in the amount of credits apportioned to a manufacturer.
        /// </remarks>
        public double TaxCreditScale { get; private set; }
        /// <summary>
        /// Gets whether to consider vehicle tax credits when estimating technology cost effectiveness as well as when
        /// evaluating the Dynamic Economic Models.
        /// </summary>
        public bool ApplyTaxCredits { get; private set; }

        //----- battery tax credits ($) -----
        /// <summary>
        /// Gets the maximum amount of battery tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// strong hybrid/electric vehicle (SHEV).
        /// </summary>
        public double BatteryTaxCreditShev { get; private set; }
        /// <summary>
        /// Gets the maximum amount of battery tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// plug-in hybrid/electric vehicle (PHEV).
        /// </summary>
        public double BatteryTaxCreditPhev { get; private set; }
        /// <summary>
        /// Gets the maximum amount of battery tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// battery electric vehicle (BEV).
        /// </summary>
        public double BatteryTaxCreditBev { get; private set; }
        /// <summary>
        /// Gets the maximum amount of battery tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// fuel cell vehicle (FCV).
        /// </summary>
        public double BatteryTaxCreditFcv { get; private set; }

        /// <summary>
        /// Gets the amount by which to scale the battery tax credits attributed to the purchase of a hybrid/electric
        /// vehicle. 
        /// </summary>
        /// <remarks>
        /// The tax credit scale is defined from the consumer's perspective, which results in the amount of battery tax
        /// credits passed through to a vehicle buyer. Conversely, the inverse of the scale (i.e., 1 - scale) is
        /// defined from the manufacturer's perspective, which results in the amount of credits apportioned to a
        /// manufacturer.
        /// </remarks>
        public double BatteryTaxCreditScale { get; private set; }
        /// <summary>
        /// Gets whether to consider battery tax credits when estimating technology cost effectiveness as well as when
        /// evaluating the Dynamic Economic Models.
        /// </summary>
        public bool ApplyBatteryTaxCredits { get; private set; }

        //----- test weight calculations -----
        /// <summary>Gets the percentage of curb weight reduction returned to payload capacity.</summary>
        /// <remarks>
        /// The payload return value applies whenever mass reduction technology is installed to a vehicle. For example,
        /// if payload return is 0%, the vehicle's payload capacity remains the same; if payload return is 100%, the
        /// vehicle's reduction in curb weight goes entirely to payload.
        /// </remarks>
        public double PayloadReturn { get; private set; }
        /// <summary>Gets the percentage of GVWR reduction returned to towing capacity.</summary>
        /// <remarks>
        /// The towing return value applies whenever mass reduction technology is installed to a vehicle. For example,
        /// if towing return is 0%, the vehicle’s towing capacity remains the same; if towing return is 100%, the
        /// vehicle's reduction in GVWR goes entirely to towing.
        /// </remarks>
        public double TowingReturn { get; private set; }

        #endregion

        #region <<< Methods >>>

        /// <summary>
        /// Returns the EPA production multiplier, based on the specified vehicle fuel type, to use for scaling the
        /// sales volumes of advanced technology and alternative fuel vehicles when calculating a manufacturer's CO-2
        /// standard and rating when evaluating compliance under EPA's CO-2 program.
        /// </summary>
        public double GetEpaMultiplier(FuelType fuelType)
        {
            return (fuelType == FuelType.Hydrogen || fuelType == FuelType.Electricity) ? this.EpaMultiplier2
                 : (fuelType == FuelType.CNG || fuelType.Contains(FuelType.Electricity)) ? this.EpaMultiplier1
                 : 1;
        }

        /// <summary>
        /// Returns the petroleum equivalence factor (PEF), specified in W-h/gallon, applicable to a vehicle with the
        /// specified fuel type.
        /// </summary>
        /// <remarks>
        /// The appropriate petroleum equivalence factor is determined as follows:<br/>
        /// * If the <paramref name="fuelType"/> parameter is <see cref="FuelType.Electricity"/>, the PEF applicable to
        ///   the battery electric vehicles (BEVs) is returned (see: <see cref="PefBev"/>).<br/>
        /// * If the <paramref name="fuelType"/> parameter is a composite of <see cref="FuelType.Electricity"/> and
        ///   other fuel type(s), the PEF applicable to the plug-in hybrid/electric vehicles (PHEVs) is returned (see:
        ///   <see cref="PefPhev"/>).<br/>
        /// * For all other fuel types, or if the PEF is not applicable during a specific year, a value of 0 (zero) is
        ///   returned.
        /// </remarks>
        public double GetPef(FuelType fuelType)
        {
            if (!this.ApplyPef) {
                return 0.0;
            }

            return (fuelType == FuelType.Electricity) ? this.PefBev
                : fuelType.Contains(FuelType.Electricity) ? this.PefPhev
                : 0.0;
        }

        /// <summary>
        /// Returns the maximum amount of credits associated with various off-cycle technologies that a manufacturer
        /// may claim toward compliance with the specified compliance <paramref name="program"/> for either
        /// battery-electric vehicles (BEVs) or non-BEVs.
        /// <br/><br/>
        /// The return values are specified in grams/mile of CO-2.
        /// </summary>
        /// <param name="program">
        ///     The compliance program for which to obtain the off-cycle credit caps. The program may be specified to
        ///     comply with NHTSA's CAFE standards, EPA's CO-2 standards, or both.
        /// </param>
        /// <param name="hevType">
        ///     The HEV type of a vehicle for which to obtain the off-cycle credit caps. If the HEV type is
        ///     <see cref="HEVType.BatteryElectric"/>, the BEV-related credit caps will be obtained; for all other HEV
        ///     types, the non-BEV credit caps will be returned.
        /// </param>
        /// <returns>
        /// The off-cycle credit caps associated with specified compliance <paramref name="program"/> and
        /// <paramref name="hevType"/>.
        /// </returns>
        public OffCycleValues GetOffCycleCaps(ComplianceProgram program, HEVType hevType)
        {
            if (hevType == HEVType.BatteryElectric) {
                return program.IsCAFEAndCO2() ? this.MaxOffCycleBevCaps
                     : program.IsCO2() ? this.OffCycleCO2BevCaps
                     : this.OffCycleCafeBevCaps;
            }
            else {
                return program.IsCAFEAndCO2() ? this.MaxOffCycleCaps
                     : program.IsCO2() ? this.OffCycleCO2Caps
                     : this.OffCycleCafeCaps;
            }
        }

        /// <summary>
        /// Returns the maximum amount of vehicle tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// vehicle that utilizes a technology with the specified index.
        /// </summary>
        /// <param name="techIndex">The index of the technology for which to obtain the vehicle tax credits.</param>
        /// <returns>The amount of vehicle tax credits associated with a specific technology.</returns>
        public double GetTaxCredit(int techIndex)
        {
            return (TechnologyIndexes.IsConversionToFCV (techIndex)) ? this.TaxCreditFcv
                 : (TechnologyIndexes.IsConversionToEV  (techIndex)) ? this.TaxCreditBev
                 : (TechnologyIndexes.IsConversionToPHEV(techIndex)) ? this.TaxCreditPhev
                 : (TechnologyIndexes.IsConversionToSHEV(techIndex)) ? this.TaxCreditShev
                 : 0;
        }
        /// <summary>
        /// Returns the maximum amount of vehicle tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// vehicle that utilizes the specified technology.
        /// </summary>
        /// <param name="tech">The technology for which to obtain the vehicle tax credits.</param>
        /// <returns>The amount of vehicle tax credits associated with the specified technology.</returns>
        public double GetTaxCredit(TechnologyInfo tech)
        {
            return this.GetTaxCredit(tech.Index);
        }

        /// <summary>
        /// Returns the amount of vehicle tax credits (aka, Federal Incentives) attributed to the purchase of a vehicle
        /// that utilizes a technology with the specified index, scaled by the <see cref="TaxCreditScale"/> amount.
        /// </summary>
        /// <param name="techIndex">
        ///     The index of the technology for which to obtain the scaled vehicle tax credits.
        /// </param>
        /// <param name="consumerPerspective">
        ///     true, to assume consumer's perspective when applying vehicle tax credit scaling;
        ///     false, to assume manufacturer's perspective.
        /// </param>
        /// <returns>The amount of scaled vehicle tax credits associated with a specific technology.</returns>
        /// <remarks>
        /// If consumer's perspective is used, the return value represents the amount of vehicle tax credits a buyer
        /// would receive for purchasing a vehicle that utilizes a specific technology. If manufacturer's perspective
        /// is used, the return value represents the amount of vehicle tax credits an auto manufacturer would receive
        /// for selling a vehicle that utilizes a specific technology.
        /// </remarks>
        public double GetScaledTaxCredit(int techIndex, bool consumerPerspective)
        {
            return this.GetTaxCredit(techIndex)
                   * (consumerPerspective ? this.TaxCreditScale : 1 - this.TaxCreditScale);
        }
        /// <summary>
        /// Returns the amount of vehicle tax credits (aka, Federal Incentives) attributed to the purchase of a vehicle
        /// that utilizes the specified technology, scaled by the <see cref="TaxCreditScale"/> amount.
        /// </summary>
        /// <param name="tech">The technology for which to obtain the scaled vehicle tax credits.</param>
        /// <param name="consumerPerspective">
        ///     true, to assume consumer's perspective when applying vehicle tax credit scaling;
        ///     false, to assume manufacturer's perspective.
        /// </param>
        /// <returns>The amount of scaled vehicle tax credits associated with the specified technology.</returns>
        /// <remarks>
        /// If consumer's perspective is used, the return value represents the amount of vehicle tax credits a buyer
        /// would receive for purchasing a vehicle that utilizes a specific technology. If manufacturer's perspective
        /// is used, the return value represents the amount of vehicle tax credits an auto manufacturer would receive
        /// for selling a vehicle that utilizes a specific technology.
        /// </remarks>
        public double GetScaledTaxCredit(TechnologyInfo tech, bool consumerPerspective)
        {
            return this.GetScaledTaxCredit(tech.Index, consumerPerspective);
        }

        /// <summary>
        /// Returns the maximum amount of battery tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// vehicle that utilizes a technology with the specified index.
        /// </summary>
        /// <param name="techIndex">The index of the technology for which to obtain the battery tax credits.</param>
        /// <returns>The amount of battery tax credits associated with a specific technology.</returns>
        public double GetBatteryTaxCredit(int techIndex)
        {
            return (TechnologyIndexes.IsConversionToFCV (techIndex)) ? this.BatteryTaxCreditFcv
                 : (TechnologyIndexes.IsConversionToEV  (techIndex)) ? this.BatteryTaxCreditBev
                 : (TechnologyIndexes.IsConversionToPHEV(techIndex)) ? this.BatteryTaxCreditPhev
                 : (TechnologyIndexes.IsConversionToSHEV(techIndex)) ? this.BatteryTaxCreditShev
                 : 0;
        }
        /// <summary>
        /// Returns the maximum amount of battery tax credits (aka, Federal Incentives) attributed to the purchase of a
        /// vehicle that utilizes the specified technology.
        /// </summary>
        /// <param name="tech">The technology for which to obtain the battery tax credits.</param>
        /// <returns>The amount of battery tax credits associated with the specified technology.</returns>
        public double GetBatteryTaxCredit(TechnologyInfo tech)
        {
            return this.GetBatteryTaxCredit(tech.Index);
        }

        /// <summary>
        /// Returns the amount of battery tax credits (aka, Federal Incentives) attributed to the purchase of a vehicle
        /// that utilizes a technology with the specified index, scaled by the <see cref="TaxCreditScale"/> amount.
        /// </summary>
        /// <param name="techIndex">
        ///     The index of the technology for which to obtain the scaled battery tax credits.
        /// </param>
        /// <param name="consumerPerspective">
        ///     true, to assume consumer's perspective when applying battery tax credit scaling;
        ///     false, to assume manufacturer's perspective.
        /// </param>
        /// <returns>The amount of scaled battery tax credits associated with a specific technology.</returns>
        /// <remarks>
        /// If consumer's perspective is used, the return value represents the amount of battery tax credits a buyer
        /// would receive for purchasing a vehicle that utilizes a specific technology. If manufacturer's perspective
        /// is used, the return value represents the amount of battery tax credits an auto manufacturer would receive
        /// for selling a vehicle that utilizes a specific technology.
        /// </remarks>
        public double GetScaledBatteryTaxCredit(int techIndex, bool consumerPerspective)
        {
            return this.GetBatteryTaxCredit(techIndex)
                   * (consumerPerspective ? this.BatteryTaxCreditScale : 1 - this.BatteryTaxCreditScale);
        }
        /// <summary>
        /// Returns the amount of battery tax credits (aka, Federal Incentives) attributed to the purchase of a vehicle
        /// that utilizes the specified technology, scaled by the <see cref="TaxCreditScale"/> amount.
        /// </summary>
        /// <param name="tech">The technology for which to obtain the scaled battery tax credits.</param>
        /// <param name="consumerPerspective">
        ///     true, to assume consumer's perspective when applying battery tax credit scaling;
        ///     false, to assume manufacturer's perspective.
        /// </param>
        /// <returns>The amount of scaled battery tax credits associated with the specified technology.</returns>
        /// <remarks>
        /// If consumer's perspective is used, the return value represents the amount of battery tax credits a buyer
        /// would receive for purchasing a vehicle that utilizes a specific technology. If manufacturer's perspective
        /// is used, the return value represents the amount of battery tax credits an auto manufacturer would receive
        /// for selling a vehicle that utilizes a specific technology.
        /// </remarks>
        public double GetScaledBatteryTaxCredit(TechnologyInfo tech, bool consumerPerspective)
        {
            return this.GetScaledBatteryTaxCredit(tech.Index, consumerPerspective);
        }

        #endregion
    }
}
