#region << Using Directives >>
using System;
using Volpe.Cafe.Generic;
//
using RC = Volpe.Cafe.RegulatoryClass;
#endregion

namespace Volpe.Cafe.EspressoUI.ModelCharts
{
    [Serializable]
    static class ChartFilters
    {

        //----- methods -----
        public static void CycleRegClasses(ref int rcFilter, int direction, RCValue<bool> vehRC)
        {
            bool hasData = false;
            while (!hasData)
            {
                rcFilter += direction;
                rcFilter = (rcFilter + 1 > RegClassCount) ? 0 : (rcFilter < 0) ? RegClassCount - 1 : rcFilter;
                //
                RC regClass = ChartFilters.RegClasses[rcFilter];
                switch (regClass)
                {
                    case RC.All            : hasData = true; break;
                    case RC.HDPUV          :
                    case RC.LightTruck     : hasData = vehRC[regClass]; break;
                    case RC.AllPassengerCar: hasData = vehRC[RC.DomesticCar] || vehRC[RC.ImportedCar]; break;
                }
            }
        }

        //----- variables -----
        // filtering chart data by reg-class
        public static int      RegClassCount = 4;
        public static string[] RegClassSuffix = new string[] { " (PC)", " (LT)", " (HDPUV)", "" };
        public static RC    [] RegClasses = {
                                RC.AllPassengerCar, // filter only PC data
                                RC.LightTruck,      // filter only LT
                                RC.HDPUV,           // filter only HDPUV
                                RC.All,             // filter only overall data
                                RC.None };          // show each individual class and overall data

    }
}
