package nerd.tuxmobil.fahrplan.congress.navigation;

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

import java.util.HashMap;
import java.util.Map;

public class RoomForC3NavConverter {

    private static final String EMPTY_STRING = "";

    private static final Map<String, String> ROOM_TO_C3NAV_MAPPING = new HashMap<String, String>() {{
        put("SAAL ADAMS", "hall-a");
        put("SAAL BORG", "hall-b");
        put("SAAL CLARKE", "hall-c");
        put("SAAL DIJKSTRA", "hall-d");

        // From everything.schedule.xml
        put("Assembly:Chaos West", "chaos-west-stage");
        put("Assembly:Bogonauten", null);
        put("Assembly:Haecksen", null);
        put("Assembly:HardwareHackingArea", "hardware-hacking-area");
        put("Assembly:Jugend hackt", "jugend-hackt");
        put("Assembly:Milliways", "milliways");
        put("Assembly:Open Knowledge Assembly", null);
        put("Assembly:Physikfachschaft Rostock", null);
        put("Assembly:TeaHouse", null);
        put("CCL Hall 3", "ccl-hall-3");
        put("Chaos West Stage", "chaos-west-stage");
        put("Hall 3", "ccl-hall-3");
        put("Hive Stage", "the-hive-stage");
        put("Kidspace", "kidspace");
        put("Komona Aquarius", "komona-aquarius");
        put("Komona Blue Princess", "komona-blue-princess");
        put("Komona Coral Reef", "komona-coral-reef");
        put("Komona D.Ressrosa", "komona-d-ressrosa");
        put("Lecture room 11", "ccl-lecture-room-11");
        put("Lecture room 12", "ccl-lecture-room-12");
        put("Seminar room 13", "ccl-seminar-room-13");
        put("Seminar room 14-15", "ccl-seminar-room-13");
    }};

    @NonNull
    public static String convert(@Nullable final String room) {
        if (room != null && !EMPTY_STRING.equals(room)) {
            String c3navName = ROOM_TO_C3NAV_MAPPING.get(room.toUpperCase());
            return c3navName == null ? EMPTY_STRING : c3navName;
        }
        return EMPTY_STRING;
    }

}

@@ -585,26 +585,26 @@
 t(%22A
-ssembly:Chaos West
+SSEMBLY:CHAOS WEST
 %22, %22
@@ -641,26 +641,26 @@
 t(%22A
-ssembly:Bogonauten
+SSEMBLY:BOGONAUTEN
 %22, n
@@ -683,24 +683,24 @@
 t(%22A
-ssembly:Haecksen
+SSEMBLY:HAECKSEN
 %22, n
@@ -723,35 +723,35 @@
 t(%22A
-ssembly:HardwareHackingArea
+SSEMBLY:HARDWAREHACKINGAREA
 %22, %22
@@ -793,28 +793,28 @@
 t(%22A
-ssembly:Jugend hackt
+SSEMBLY:JUGEND HACKT
 %22, %22
@@ -847,25 +847,25 @@
 t(%22A
-ssembly:Milliways
+SSEMBLY:MILLIWAYS
 %22, %22
@@ -895,95 +895,95 @@
 t(%22A
-ssembly:Open Knowledge Assembly%22, null);%0A        put(%22Assembly:Physikfachschaft Rostock
+SSEMBLY:OPEN KNOWLEDGE ASSEMBLY%22, null);%0A        put(%22ASSEMBLY:PHYSIKFACHSCHAFT ROSTOCK
 %22, n
@@ -1006,24 +1006,24 @@
 t(%22A
-ssembly:TeaHouse
+SSEMBLY:TEAHOUSE
 %22, n
@@ -1046,19 +1046,19 @@
 t(%22CCL H
-all
+ALL
  3%22, %22cc
@@ -1087,23 +1087,23 @@
 t(%22C
-haos West Stage
+HAOS WEST STAGE
 %22, %22
@@ -1136,19 +1136,19 @@
   put(%22H
-all
+ALL
  3%22, %22cc
@@ -1177,17 +1177,17 @@
 t(%22H
-ive Stage
+IVE STAGE
 %22, %22
@@ -1218,23 +1218,23 @@
   put(%22K
-idspace
+IDSPACE
 %22, %22kids
@@ -1259,22 +1259,22 @@
 t(%22K
-omona Aquarius
+OMONA AQUARIUS
 %22, %22
@@ -1310,27 +1310,27 @@
 t(%22K
-omona Blue Princess
+OMONA BLUE PRINCESS
 %22, %22
@@ -1371,24 +1371,24 @@
 t(%22K
-omona Coral Reef
+OMONA CORAL REEF
 %22, %22
@@ -1426,24 +1426,24 @@
 t(%22K
-omona D.Ressrosa
+OMONA D.RESSROSA
 %22, %22
@@ -1477,27 +1477,27 @@
   put(%22L
-ecture room
+ECTURE ROOM
  11%22, %22c
@@ -1536,19 +1536,19 @@
 t(%22L
-ecture room
+ECTURE ROOM
  12%22
@@ -1587,27 +1587,27 @@
   put(%22S
-eminar room
+EMINAR ROOM
  13%22, %22c
@@ -1646,19 +1646,19 @@
 t(%22S
-eminar room
+EMINAR ROOM
  14-

Enable navigation for most of the locations!