/**
 * A module which contains the definition of the application and the base of configuration
 *
 * @module app/index/services/index
 * @exports app/index
 *
 * @author Developer Developer
 */

import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import "font-awesome/css/font-awesome.css"
import angular from 'angular';
import angular_cookies from 'angular-cookies';
import angular_sanitize from 'angular-sanitize';
import angular_ui_router from 'angular-ui-router';
import angular_animate from 'angular-animate';
import angular_clipboard from 'angular-clipboard';
import angular_ui_bootstrap from 'angular-ui-bootstrap';
import angular_route from 'angular-route';
import angular_utils from 'angularUtils/src/angularUtils.js';
import angular_utils_pagination from 'angularUtils/src/directives/pagination/dirPagination.js';
require('./styles/index.scss')

// TODO(Ed)  clean this up, add the appropriate imports to phosphor-webui

import constants_index from './constants/index.js'
import environment_constants from './constants/environment-constants.js'

import services_index from './common/services/index.js'
import constants from './common/services/constants.js'
import dataService from './common/services/dataService.js'
import api_utils from './common/services/api-utils.js'
import userModel from './common/services/userModel.js'
import apiInterceptor from './common/services/apiInterceptor.js'

import filters_index from './common/filters/index.js'

import directives_index from './common/directives/index.js'
import errors from './common/directives/errors.js'
import app_header from './common/directives/app-header.js'
import app_navigation from './common/directives/app-navigation.js'
import confirm from './common/directives/confirm.js'
import log_event from './common/directives/log-event.js'
import log_filter from './common/directives/log-filter.js'
import log_search_control from './common/directives/log-search-control.js'
import toggle_flag from './common/directives/toggle-flag.js'
import firmware_list from './common/directives/firmware-list.js'
import file from './common/directives/file.js'
import loader from './common/directives/loader.js'
import paginate from './common/directives/paginate.js'

import login_index from './login/index.js'
import login_controller from './login/controllers/login-controller.js'

import overview_index from './overview/index.js'
import system_overview_controller from './overview/controllers/system-overview-controller.js'

import server_control_index from './server-control/index.js'
import bmc_reboot_controller from './server-control/controllers/bmc-reboot-controller.js'
import power_operations_controller from './server-control/controllers/power-operations-controller.js'
import remote_console_controller from './server-control/controllers/remote-console-controller.js'
import remote_console_window_controller from './server-control/controllers/remote-console-window-controller.js'

import server_health_index from './server-health/index.js'
import diagnostics_controller from './server-health/controllers/diagnostics-controller.js'
import inventory_controller from './server-health/controllers/inventory-controller.js'
import inventory_overview_controller from './server-health/controllers/inventory-overview-controller.js'
import log_controller from './server-health/controllers/log-controller.js'
import power_consumption_controller from './server-health/controllers/power-consumption-controller.js'
import sensors_controller from './server-health/controllers/sensors-controller.js'
import sensors_overview_controller from './server-health/controllers/sensors-overview-controller.js'
import unit_id_controller from './server-health/controllers/unit-id-controller.js'

import configuration_index from './configuration/index.js'
import date_time_controller from './configuration/controllers/date-time-controller.js'
import file_controller from './configuration/controllers/file-controller.js'
import network_controller from './configuration/controllers/network-controller.js'
import security_controller from './configuration/controllers/security-controller.js'
import firmware_controller from './configuration/controllers/firmware-controller.js'

import firmware_index from './firmware/index.js'
import bmc_controller from './firmware/controllers/bmc-controller.js'
import server_controller from './firmware/controllers/server-controller.js'

import multi_server_index from './multi-server/index.js'
import multi_server_controller from './multi-server/controllers/multi-server-controller.js'

import users_index from './users/index.js'
import user_accounts_controller from './users/controllers/user-accounts-controller.js'

import phosphor_templates from './templates.js';
import phosphor_vendors from './vendors.js';

window.angular && (function (angular) {
    'use strict';

    angular
        .module('app', [
            // Dependencies
            'ngRoute',
            'angular-clipboard',
            'angularUtils.directives.dirPagination',
            // Basic resources
            'app.constants',
            'app.templates',
            'app.vendors',
            'app.common.services',
            'app.common.directives',
            'app.common.filters',
            // Model resources
            'app.login',
            'app.overview',
            'app.serverControl',
            'app.serverHealth',
            'app.configuration',
            'app.users',
            'app.multiServer'
        ])
        // Route configuration
        .config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
            $locationProvider.hashPrefix('');
            $routeProvider
                .otherwise({
                    'redirectTo': '/login'
                });
        }])
        .config(['$compileProvider', function ($compileProvider) {
          $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|file|data|blob):/);
        }])
        .config(['$httpProvider', function($httpProvider){
            $httpProvider.defaults.timeout = 20000;
            $httpProvider.interceptors.push('apiInterceptor');
        }])
        .run(['$rootScope', '$location', 'dataService', 'userModel',
           function($rootScope, $location, dataService, userModel){
           $rootScope.dataService = dataService;
           dataService.path = $location.path();
           $rootScope.$on('$routeChangeStart', function(event, next, current){
             if(next.$$route == null || next.$$route == undefined) return;
             if(next.$$route.authenticated){
               if(!userModel.isLoggedIn()){
                 $location.path('/login');
               }
             }

             if(next.$$route.originalPath == '/' ||
               next.$$route.originalPath == '/login'){
                if(userModel.isLoggedIn()){
                   if(current && current.$$route){
                     $location.path(current.$$route.originalPath);
                   }else{
                     $location.path('/overview/server');
                   }
                }
             }
           });
           $rootScope.$on('$locationChangeSuccess', function(event){
               var path = $location.path();
               dataService.path = path;
               if(['/','/login','/logout'].indexOf(path) == -1 &&
                path.indexOf('/login') == -1){
                   dataService.showNavigation = true;
               }else{
                   dataService.showNavigation = false;
               }
           });

           $rootScope.$on('timedout-user', function(){
             sessionStorage.removeItem('LOGIN_ID');
             $location.path('/login');
           });
           }
        ]);

})(window.angular);
