define([
	'backbone',
	'SchedulingResourceDirectory',
	'ResourceLink'
],
	function(Backbone, SchedulingResourceDirectory, ResourceLink){
		'use strict';
		var singleInstance;
		var Collection = Backbone.Collection.extend({
			model: ResourceLink,
			url: '#',
			parse: function(response){
				return response.link;
			},
			initialize: function(){
				if(typeof SchedulingResourceDirectory.instance().get('location-service-resource-directory') !== 'undefined'){
					this.url = SchedulingResourceDirectory.instance().get('location-service-resource-directory').href;
					this.fetch({async: false, cache: false});
				}
				else{
					this.url = "#";
				}
			}
		});

		Collection.instance = function() {
			if (typeof singleInstance === "undefined") {
				singleInstance = new Collection();
			}
			return singleInstance;
		};

		return Collection;
	}
);
