//  @import com.hedgehoglab.application.model.BaseModel;

function ActivityModel(scope){
	BaseModel.call(this,scope);
    var _model=null;
    var _model_lookup={activity:{}};
	var _agg_lookup=[];
	
	this.model=function(model){
        if(arguments.length>0){
			_model=model;
			this.raise_event('model_changed',{
				model: _model
			});
		}
		return _model;
	};
	
	this.aggregate=function(model){
		//	Return only the top 10
		// var _agg_lookup={activity:{}};
		if(model){
			_agg_lookup=$.makeArray(model.activity);//[];	
						
			_agg_lookup=_agg_lookup.sort(function(a,b){
				var da=Date.parse(a.createdAt);
				var db=Date.parse(a.createdAt);

	            return !db.compareTo(da);
			});

		}
		
		return _agg_lookup;
	};
	
}