using System;

namespace Volpe.Cafe.DfsSrModels
{
    /// <summary>
    /// Represents an object that stores aggregated modeling data for each type of fleet supported by the various
    /// DFS models.
    /// </summary>
    [Serializable]
    public struct FleetTypeValue
    {
        /// <summary>
        /// Initializes a new <see cref="FleetTypeValue"/> instance, using the specified values for each type of fleet.
        /// </summary>
        public FleetTypeValue(double car, double truck, double hdpuv)
        {
            this.Car = car;
            this.Truck = truck;
            this.Hdpuv = hdpuv;
        }

        /// <summary>Gets or sets the modeling data value associated with the car fleet.</summary>
        public double Car { get; set; }
        /// <summary>Gets or sets the modeling data value associated with the truck fleet.</summary>
        public double Truck { get; set; }
        /// <summary>Gets or sets the modeling data value associated with the HDPUV fleet.</summary>
        public double Hdpuv { get; set; }

        /// <summary>
        /// Gets the modeling data value for the fleet type associated with a given <see cref="RegulatoryClass"/>.
        /// </summary>
        public double this[RegulatoryClass regClass]
        {
            get {
                switch (regClass) {
                    case RegulatoryClass.DomesticCar:
                    case RegulatoryClass.ImportedCar:
                    case RegulatoryClass.AllPassengerCar:
                        return this.Car;

                    case RegulatoryClass.LightTruck:
                        return this.Truck;

                    case RegulatoryClass.HDPUV:
                        return this.Hdpuv;

                    default:
                        return 0;
                }
            }
        }

        /// <summary>
        /// Gets the modeling data value for the fleet type associated with a given <see cref="VehicleClass"/>.
        /// </summary>
        public double this[VehicleClass vehClass]
        {
            get {
                switch (vehClass) {
                    case VehicleClass.LDV:
                        return this.Car;

                    case VehicleClass.LDT1:
                    case VehicleClass.LDT2a:
                    case VehicleClass.LDT12a:
                        return this.Truck;

                    case VehicleClass.LDT2b:
                    case VehicleClass.LDT3:
                    case VehicleClass.LDT2b3:
                        return this.Hdpuv;

                    default:
                        return 0;
                }
            }
        }

    }
}
