'use strict';

/**
 * @ngdoc service
 * @name annotationAppApp.analysisStats
 * @description
 * # analysisStats
 * Service in the annotationAppApp.
 */
 angular.module('app')
 .service('AnalysisStats', function ($http,$q,HostFactory) {

 	var SCHEME, DB_URL_COMPONENT, COLLECTION_NAME, HOST, URL_PATH;

 	COLLECTION_NAME = 'analysisStats';

 	SCHEME = HostFactory.getScheme();
 	HOST = HostFactory.getHost();
 	DB_URL_COMPONENT = HostFactory.getDbUrlComponent();

 	URL_PATH = SCHEME + '://' + HOST + '/api/' + DB_URL_COMPONENT + '/' + COLLECTION_NAME;



 	var Service;

 	Service={
 		save: function(analysisStat){
 			var def;

 			def=$q.defer();

 			$http.post(URL_PATH,analysisStat).success(function(data){
 				def.resolve(data);
 			}).error(function(err){
 				def.reject(err);
 			});

 			return def.promise;
 		}
 	};

 	return Service;
 });