(function(){
  'use strict';

angular.module('LighthouseApp', ['ngMaterial', 'users', 'questions', 'assignments', 'dashboard', 'restangular','ui.router'])
              .config(function($mdThemingProvider, $mdIconProvider, RestangularProvider,$stateProvider, $urlRouterProvider){

                  $urlRouterProvider.otherwise("/login");

                  $stateProvider
                    .state('login', {
                      url: "/login",
                      templateUrl: "assets/partials/login.html"
                    })
                    .state('dashboard', {
                      url: "/dashboard",
                      templateUrl: "assets/partials/dashboard.html"
                    })
                    .state('assignment_details', {
                      url: "/assignment_details/:assignmentId",
                      templateUrl: "assets/partials/assignment_details.html"
                    });

                  $mdIconProvider
                      .defaultIconSet("./assets/svg/avatars.svg", 128)
                      .icon("menu"       , "./assets/svg/menu.svg"        , 24)
                      .icon("share"      , "./assets/svg/share.svg"       , 24)
                      .icon("google_plus", "./assets/svg/google_plus.svg" , 512)
                      .icon("hangouts"   , "./assets/svg/hangouts.svg"    , 512)
                      .icon("twitter"    , "./assets/svg/twitter.svg"     , 512)
                      .icon("phone"      , "./assets/svg/phone.svg"       , 512);

                      $mdThemingProvider.theme('default')
                          .primaryPalette('brown')
                          .accentPalette('red');

                      RestangularProvider.setBaseUrl('http://sandbox.api.hmhco.com/v1');

                      RestangularProvider.setFullRequestInterceptor(function(element, operation, route, url, headers, params, httpConfig) {
                         debugger;

                          if (url == 'http://sandbox.api.hmhco.com/v1/sample_token'){
                            debugger;
                            headers['Content-Type'] = 'application/x-www-form-urlencoded'
                          } else {
                             headers['Authorization']='SIF_HMACSHA256 <KEY>'
                          }

                          headers['Vnd-HMH-Api-Key']='<KEY>'

                          return {
                                  element: element,
                                  params: params,
                                  headers: headers,
                                  httpConfig: httpConfig
                          };
                      });

              });

})();

