package org.lantern.state;


/**
 * The available channels to sync on.
 */
public enum SyncPath {
    SETTINGS("settings"), 
    VERSION_UPDATED("version.latest"), 
    ROSTER("roster"), 
    MODAL("modal"), 
    ALL(""), 
    PROFILE("profile"), 
    MODE("settings.mode"),
    CONNECTIVITY_GTALK("connectivity.gtalk"), 
    PEERS("connectivity.peers"), 
    INVITED("connectivity.invited"), 
    NINVITES("ninvites"), 
    START_AT_LOGIN("settings.startAtLogin"),
    AUTO_CONNECT("settings.autoConnect"),
    AUTO_REPORT("settings.autoReport"),
    PROXY_ALL_SITES("settings.proxyAllSites"), 
    SUBSCRIPTION_REQUESTS("friends.pending");
    
    private final String path;
    
    private SyncPath(final String path) {
        this.path = path;
        // We do a dummy check here to make sure to catch any bogus paths.
        // The check doesn't work with enum properties unfortunately.
        /*
        try {
            final Object obj = LanternUtils.getTargetForPath(model, path);
            if (obj == null) {
                throw new Error("Path is invalid for model: "+path);
            }
        } catch (final IllegalAccessException e) {
            throw new Error("Path is invalid for model: "+path, e);
        } catch (final InvocationTargetException e) {
            throw new Error("Path is invalid for model: "+path, e);
        } catch (final NoSuchMethodException e) {
            throw new Error("Path is invalid for model: "+path, e);
        }
        */
    }

    public String getPath() {
        return path;
    }
}
@@ -112,25 +112,24 @@
 %22settings%22),
- 
 %0A    VERSION
@@ -145,17 +145,17 @@
 %22version
-.
+/
 latest%22)
@@ -155,17 +155,16 @@
 atest%22),
- 
 %0A    ROS
@@ -177,17 +177,16 @@
 oster%22),
- 
 %0A    MOD
@@ -197,17 +197,16 @@
 modal%22),
- 
 %0A    ALL
@@ -210,17 +210,16 @@
 ALL(%22%22),
- 
 %0A    PRO
@@ -234,17 +234,16 @@
 ofile%22),
- 
 %0A    MOD
@@ -253,17 +253,17 @@
 settings
-.
+/
 mode%22),%0A
@@ -302,17 +302,17 @@
 vity
-.
+/
 gtalk%22),
  %0A  
@@ -307,17 +307,16 @@
 gtalk%22),
- 
 %0A    PEE
@@ -335,17 +335,17 @@
 vity
-.
+/
 peers%22),
  %0A  
@@ -336,25 +336,24 @@
 ity/peers%22),
- 
 %0A    INVITED
@@ -366,17 +366,17 @@
 ectivity
-.
+/
 invited%22
@@ -377,17 +377,16 @@
 vited%22),
- 
 %0A    NIN
@@ -399,25 +399,24 @@
 %22ninvites%22),
- 
 %0A    START_A
@@ -432,17 +432,17 @@
 settings
-.
+/
 startAtL
@@ -471,25 +471,25 @@
 CT(%22settings
-.
+/
 autoConnect%22
@@ -516,17 +516,17 @@
 settings
-.
+/
 autoRepo
@@ -560,17 +560,17 @@
 settings
-.
+/
 proxyAll
@@ -577,17 +577,16 @@
 Sites%22),
- 
 %0A    SUB
@@ -612,17 +612,17 @@
 %22friends
-.
+/
 pending%22
@@ -624,20 +624,16 @@
 ding%22);%0A
-    
 %0A    pri
@@ -656,20 +656,16 @@
 g path;%0A
-    
 %0A    pri

fix paths to be json-pointer paths