(function () {
    'use strict';

    /* ngInject */
    function NavigateController(
        $scope,
        Navigation, Directions, Map, MapStyle, NavbarConfig, MapControl
    ) {
        var ctl = this;
        initialize();

        function initialize() {
            NavbarConfig.set({
                title: 'Navigate Route',
                back: 'routing'
            });
            ctl.map = Map;

            Navigation.setIntervalMillis(800);
            var directionQ = Directions.get();
            directionQ.then(setGeojson);
            directionQ.then(Navigation.walkTheLine);

            // Subscribe to the location update event
            $scope.$on('nih.navigation.locationUpdated', function(event, data) {
                MapControl.trackUser(data);
                angular.extend(ctl.map.center, {
                    lat: data[1],
                    lng: data[0],
                    zoom: 19
                });
            });
            $scope.$on('$stateChangeStart', Navigation.stopIntervalTask);
        }


        function setGeojson(geojson) {
            angular.extend(ctl.map, {
                geojson: {
                    data: geojson,
                    style: MapStyle.routeStyle,
                    resetStyleOnMouseout: true
                }
            });

        }
    }

    angular.module('nih.views.navigate')
      .controller('NavigateController', NavigateController);

})();

@@ -1,8 +1,583 @@
+/**%0A *%0A * This navigation controller does nothing, now that the Directions.get endpoint returns an%0A * actual response. Rather than restub it out now, we can just properly build out the remainder%0A * of the interactions on this view all at once.%0A *%0A * TODO:%0A *   - Init map at current location navigating to destination param via Directions.get()%0A *   - Add direction text, e.g. Turn left in x ft at 1000 Market St%0A *   - When we approach each step, speak audible alert and then switch the current direction text%0A *   - Offer to reroute user if they leave the current path%0A */%0A
 (functio

Add TODO notes for NavigationController