define([
	'Global'
],
	function(Global) {
		var Version = Backbone.Model.extend({
			defaults: {
				version: ""
			},
			initialize: function() {
				this.url = 'version.json';
				this.fetch({async: false});
			},
			parse: function (response) {
				var version = response.version;
				var build = response.build;

				response.version = version === "undefined" ? "" : version;
				if(build){
					response.version = response.version + "." + build;
				}

				return response;
			}
		});

		Version.singleInstance = null;

		Version.instance = function () {
			Version.singleInstance = Version.singleInstance || new Version();
			return Version.singleInstance;
		};

		return Version;
	}
);