/* Controllers */

function GlobalController(){}

MailChimpSignupController.$inject = ['Request'];
function MailChimpSignupController(Request){
	this.Request = Request;
}
MailChimpSignupController.prototype = {
	signup: function(){
		this.Request({
			scope: this,
			resourceId: 'mailchimp',
			data: {
				EMAIL: this.email,
				FNAME: this.firstName,
				LNAME: this.lastName
			},
			success: function(scope, data){
				scope.submitted = true;
			}
		});
	}
}

TwitterWidgetController.$inject = ['Request', 'Utils'];
function TwitterWidgetController(Request, Utils){
	this.Request = Request;
	this.Utils = Utils;
	this.getTweets();
}
TwitterWidgetController.prototype = {
	getTweets: function(){
		this.Request({
			scope: this,
			resourceId: 'twitter',
			data: {
				user: 'AbundanceGen',
				count: 3
			},
			success: function(scope, data){
				scope.tweets = data;
			}
		});
	},
	
	hasTweets: function(){
		return this.tweets && angular.Array.count(this.tweets) > 0;
	},
	
	getIsoDate: function(tweet){
		return this.Utils.parseISO8601Date(tweet.created_at);
	}
}

