'use strict';

angular.module('app').run([ '$rootScope', '$state', function($rootScope, $state) {
	// $rootScope.$on('$stateChangeStart', function(event, toState, toParam,
	// fromState, fromParam) {
	// console.log('----------------------');
	// });
	// $rootScope.$on('$stateChangeError', function(event, toState, toParam,
	// fromState, fromParam) {
	// console.log('------------------333333----');
	// });

} ]).config(function($stateProvider, $urlRouterProvider) {
	$urlRouterProvider.otherwise('/app/main');
	$stateProvider.state('app', {
		url : '/app',
		templateUrl : 'route/app.html'
	}).state('app.main', {
		url : '/main',
		templateUrl : 'route/main/main.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/main/main.js' ]
				});
			} ]
		}
	}).state('app.school', {
		url : '/school',
		templateUrl : 'route/school/school.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/school/school.js' ]
				});
			} ]
		}
	}).state('app.enrolnav', {
		url : '/enrolnav',
		templateUrl : 'route/enrol_nav/enrol_nav.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/enrol_nav/enrol_nav.js' ]
				});
			} ]
		}
	}).state('app.enrolinfo', {
		url : '/enrolinfo/:pay_flag/:enrol_id/',
		templateUrl : 'route/enrol_info/enrol_info.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/enrol_info/enrol_info.js' ]
				});
			} ]
		}
	}).state('app.enrolscore', {
		url : '/enrolscore/:enrol_id/',
		templateUrl : 'route/enrol_score/enrol_score.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/enrol_score/enrol_score.js' ]
				});
			} ]
		}
	}).state('app.photo', {
		url : '/photo',
		templateUrl : 'route/photo/std_photo.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/photo/std_photo.js' ]
				});
			} ]
		}
	}).state('app.stdinfo', {
		url : '/stdinfo',
		templateUrl : 'route/std_info/std_info.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/std_info/std_info.js' ]
				});
			} ]
		}
	}).state('app.ticket', {
		url : '/ticket/:down_flag',
		templateUrl : 'route/ticket/ticket.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/ticket/ticket.js' ]
				});
			} ]
		}
	}).state('app.score', {
		url : '/score',
		templateUrl : 'route/score/score.html',
		resolve : {
			deps : [ '$ocLazyLoad', function($ocLazyLoad) {
				return $ocLazyLoad.load({
					files : [ 'route/score/score.js' ]
				});
			} ]
		}
	})
});