package com.itachi1706.cheesecakeutilities.Modules.VehicleMileageTracker.Objects;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Kenneth on 28/7/2017.
 * for com.itachi1706.cheesecakeutilities.Modules.VehicleMileageTracker.Objects in CheesecakeUtilities
 */

public class VehicleClass {

    private static List<VehClass> vehClassList;

    public static VehClass getClassType(String id) {
        if (vehClassList == null) init();
        for (VehClass v : vehClassList) {
            if (v.getId().equalsIgnoreCase(id)) return v;
        }
        return null;
    }

    public static VehClass getClassTypeWithName(String className) {
        if (vehClassList == null) init();
        for (VehClass v : vehClassList) {
            if (v.getFullname().equalsIgnoreCase(className)) return v;
        }
        return null;
    }

    public static List<VehClass> getVehClassList() {
        if (vehClassList == null) init();
        return vehClassList;
    }

    private static void init() {
        vehClassList = new ArrayList<>();
        vehClassList.add(new VehClass("class2", "Class 2"));
        vehClassList.add(new VehClass("class3", "Class 3/3A"));
        vehClassList.add(new VehClass("class4", "Class 4"));
        vehClassList.add(new VehClass("class4a", "Class 4A"));
        vehClassList.add(new VehClass("class5", "Class 5"));
    }

    public static class VehClass {
        private String id, fullname;

        VehClass(String id, String fullname) {
            this.id = id;
            this.fullname = fullname;
        }

        @NonNull
        public String getId() {
            return id;
        }

        public String getFullname() {
            return fullname;
        }
    }

}

@@ -1201,14 +1201,20 @@
 ass 
+2A/2B/
 2%22));%0A
-
     
@@ -1330,24 +1330,164 @@
 Class 4%22));%0A
+        vehClassList.add(new VehClass(%22class4s%22, %22Class 4S (Cargo Trailer)%22));%0A        vehClassList.add(new VehClass(%22class5%22, %22Class 5%22));%0A
         vehC
@@ -1532,16 +1532,31 @@
 Class 4A
+ (Public Buses)
 %22));%0A   
@@ -1588,33 +1588,33 @@
  VehClass(%22class
-5
+1
 %22, %22Class 5%22));%0A
@@ -1599,33 +1599,111 @@
 class1%22, %22Class 
-5
+1 (Disabled)%22));%0A        vehClassList.add(new VehClass(%22class3c%22, %22Class 3C/3CA
 %22));%0A    %7D%0A%0A    

Add the rest of the vehicle classes in SG