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 transmission.
    /// </summary>
    /// <seealso cref="ITransmission"/>
    [Serializable]
    public sealed class BaselineTransmission : BaselineComponent
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="BaselineTransmission"/> class.
        /// </summary>
        public BaselineTransmission(Dictionary<string, object> values) : base(values) { }

        /// <summary>
        /// Gets the type of the transmission (A, M, CVT, AMT, DCT).
        /// </summary>
        public TransmissionType Type { get; private set; }
        /// <summary>
        /// Gets the number of forward gears the transmission has.
        /// </summary>
        public int NumForwardGears { get; private set; }

        /// <summary>
        /// Returns the string representation of this <see cref="BaselineTransmission"/> instance.
        /// </summary>
        /// <returns>The string representation of the <see cref="BaselineTransmission"/> instance.</returns>
        public override string ToString()
        {
            return this.Type.IsCVT() ? "CVT"
                : this.Type.IsSequential() ? $"S{this.NumForwardGears}"
                : $"{this.Type}{this.NumForwardGears}";
        }

    }
}
