 
 (defn go
   "Redirect the user to other url."
-  ([name] (go name nil))
-  ([name params] (rs/emit! (navigate name params))))
+  ([id] (go id nil))
+  ([id params] (rs/emit! (navigate id params))))
 
 (defn route-for
   "Given a location handler and optional parameter map, return the URI
   for such handler and parameters."
-  ([location]
-   (bidi/path-for routes location))
-  ([location params]
-   (apply bidi/path-for routes location (into []
-                                              (mapcat (fn [[k v]] [k v]))
-                                              params))))
+  ([id]
+   (bidi/path-for routes id))
+  ([id params]
+   (apply bidi/path-for routes id (into [] (mapcat (fn [[k v]] [k v])) params))))

  (:require [bidi.router]
            [bidi.bidi :as bidi]
            [goog.events :as events]
            [uxbox.rstore :as rs]))

(enable-console-print!)

(def +router+ nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Events

(def ^:private page-route
  [[bidi/uuid :project-uuid] "/" [bidi/uuid :page-uuid]])

(def ^:const routes
  ["/" [["auth/login" :auth/login]
        ["auth/register" :auth/register]
        ["auth/recover" :auth/recover-password]
        ["dashboard/" [["projects" :dashboard/projects]
                       ["elements" :dashboard/elements]
                       ["icons" :dashboard/icons]
                       ["colors" :dashboard/colors]]]
        ["workspace/" [[page-route :workspace/page]]]]])

(defn init
  []
  (let [opts {:on-navigate #(rs/emit! (update-location %))
              :default-location {:handler :auth/login}}
        router (bidi.router/start-router! routes opts)]
    (vreset! +router+ router)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Public Api
