(function() {

	'use strict';
	
	angular.module('ti_common').service('ticUserAcctMgmt', ticUserAcctMgmt);
	
	ticUserAcctMgmt.$inject = ['$http', '$window'];
	
	function ticUserAcctMgmt(http, window) {

		var obj : any = {};
		var userInfoPromise;

		obj.getUserInfo = function() {

			if (userInfoPromise) {
				return userInfoPromise;
			} else {
				userInfoPromise = http.get('/api/queryUserStatus/');
			}

			return userInfoPromise;
		};

		obj.logout = function() {
			window.location.href = '/logout';
		};

		return obj;
	}

	
})();