if (Calculators == undefined) {
	var Calculators = {};
}
if (Calculators.type == undefined) {
	Calculators.type = {};
}
Calculators.type.YearlySnapshot = function YearlySnapshot(beginningBalance, investment, contributions, expenses) {
	this.beginningBalance = new Calculators.type.Money(beginningBalance);
	this.investment = new Calculators.type.Money(investment);
	this.contributions = new Calculators.type.Money(contributions);
	this.expenses = new Calculators.type.Money(expenses);
	
	this.getBeginningBalance = function() {
		return this.beginningBalance;
	}
	
	this.getInvestmentGrowth = function() {
		return this.investment;
	}
	
	this.getContributions = function() {
		return this.contributions;
	}
	
	this.getExpenses = function() {
		return this.expenses;
	}
	
	this.getAvailableBeforeExpenses = function() {
		var available = this.beginningBalance.add(this.contributions).add(this.investment);
		return available;
	}
	
	this.getWithdrawal = function() {
		var available = this.getAvailableBeforeExpenses();
		if (available.getAmount() > this.expenses.getAmount()) {
			return this.expenses;
		}
		else {
			return available;
		}
	}
	
	this.getEndingBalance = function() {
		var available = this.getAvailableBeforeExpenses();
		if (available.getAmount() > this.expenses.getAmount()) {
			return (available.subtract(this.expenses));
		}
		else {
			return new Calculators.type.Money(0);
		}
	}
}

