var services=angular.module("silverpeas.services");services.factory("Suggestion",["RESTAdapter",function(a){return new function(){var b=function(){this.type="Suggestion"};var c=function(){this.type="SuggestionComment"};this.suggestions=function(d){return new function(){var e=a.get(d+"/suggestions",b);var f=a.get(d+"/suggestions/lastComments",c);this.get=function(){if(arguments.length===1&&(typeof arguments[0]==="number"||typeof arguments[0]==="string")){return e.find(arguments[0])}else{var g=e.url;var h=arguments[0];if(arguments.length>1){g+="/"+arguments[0];h=arguments[1]}return e.find({url:g,criteria:e.criteria(h)})}};this.remove=function(g){return e.remove(g)};this.publish=function(g){return e.update(g.id+"/publish",g)};this.lastComments=function(g){if(typeof g==="number"){return f.find(f.criteria({count:g}))}else{return f.find()}}}}}}]);services.factory("SuggestionBox",["context","Suggestion","RESTAdapter",function(a,c,b){return new function(){var e=webContext+"/services/suggestionbox/"+a.component;var d=function(f){for(var g in f){this[g]=f[g]}this.suggestions=c.suggestions(e+"/"+this.id)};this.get=function(f){if(typeof f==="object"&&(f.id||f.componentInstanceId)){var g={};if(f.id){g.id=f.id;g.componentInstanceId=f.id}if(f.componentInstanceId){g.componentInstanceId=f.componentInstanceId;if(f.id===undefined){g.id=f.componentInstanceId}}return new d(g)}else{notyError("Error: missing suggestion box id or componentInstanceId property")}}}}]);