/* global angular, random */
angular.module("app").config([
    '$stateProvider',
    '$urlRouterProvider',
    function ($stateProvider, $urlRouterProvider) {
        $urlRouterProvider.otherwise('/iniciar-sesion');
        $stateProvider.state('login', {
            url: '/iniciar-sesion',
            templateUrl: 'templates/auth/login-form.html' + random,
            controller: "LoginCtrl",
            resolve: {
                loadMyCtrl: [
                    '$ocLazyLoad',
                    function ($ocLazyLoad) {
                        return $ocLazyLoad.load([
                            'js/vendors/sha-1.min.js',
                            'js/controllers/auth-controllers.js' + random,
                            'js/services/auth-services.js' + random
                        ]);
                    }
                ]
            }
        });
        $stateProvider.state('confirmar_acceso', {
            url: '/confirmar-acceso?codigo',
            templateUrl: 'templates/auth/elegir-password-form.html' + random,
            controller: "ConfirmarAccesoCtrl",
            resolve: {
                loadMyCtrl: [
                    '$ocLazyLoad',
                    function ($ocLazyLoad) {
                        return $ocLazyLoad.load([
                            'js/vendors/sha-1.min.js',
                            'js/controllers/auth-controllers.js' + random,
                            'js/services/auth-services.js' + random
                        ]);
                    }
                ]
            }
        });
        $stateProvider.state('restablecer_accceso', {
            url: '/restablecer-accceso',
            templateUrl: 'templates/auth/enviar-usuario-form.html' + random,
            controller: "EnviarUsuarioCtrl",
            resolve: {
                loadMyCtrl: [
                    '$ocLazyLoad',
                    function ($ocLazyLoad) {
                        return $ocLazyLoad.load([
                            {
                                name: 'jcs-autoValidate',
                                serie: true,
                                files: [
                                    'js/modules/jcs-auto-validate.min.js',
                                    'js/controllers/auth-controllers.js' + random,
                                    'js/services/auth-services.js' + random
                                ]
                            }
                        ]);
                    }
                ]
            }
        });
    }
]);
