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

namespace Volpe.Cafe.MarketData.BaselineInfo
{
    /// <summary>
    /// Provides a description of baseline engineering characteristics for a vehicle engine.
    /// </summary>
    /// <seealso cref="IEngine"/>
    [Serializable]
    public sealed class BaselineEngine : BaselineComponent
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="BaselineEngine"/> class.
        /// </summary>
        public BaselineEngine(Dictionary<string, object> values) : base(values) { }

        /// <summary>Gets the fuel types that the engine may operate on.</summary>
        public FuelType Fuel { get; private set; }
        /// <summary>Gets the engine's valvetrain design.</summary>
        public EngineValvetrain ValvetrainDesign { get; private set; }
        /// <summary>Gets the engine's displacement.</summary>
        public double Displacement { get; private set; }
        /// <summary>Gets the engine's configuration.</summary>
        public EngineConfiguration Configuration { get; private set; }
        /// <summary>Gets the number of cylinders in the engine.</summary>
        public int Cylinders { get; private set; }
        /// <summary>Gets the number of banks in the engine.</summary>
        public int Banks => this.Configuration.GetNumberOfBanks();
        /// <summary>Gets whether the engine is naturally aspirated or super-/turbo-charged.</summary>
        public EngineAspiration Aspiration { get; private set; }

        /// <summary>
        /// Returns the string representation of this <see cref="BaselineEngine"/> instance.
        /// </summary>
        /// <returns>The string representation of the <see cref="BaselineEngine"/> instance.</returns>
        public override string ToString()
        {
            return $"{this.Displacement:0.0}L {this.Configuration}{this.Cylinders} " +
                   $"({this.Aspiration.ToString(true)})";
        }

    }
}
