// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/tasks/datareviewer/DashboardTask","dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/Deferred dojo/has ./_DRSBaseTask ./DashboardResult ./ReviewerFilters ../../kernel ../../request".split(" "),function(d,m,k,n,q,r,t,u,v,p){d=d(r,{declaredClass:"esri.tasks.datareviewer.DashboardTask",constructor:function(a){this.onGetDashboardResultsComplete=k.hitch(this,this.onGetDashboardResultsComplete);this.onGetDashboardFieldNamesComplete=k.hitch(this,this.onGetDashboardFieldNamesComplete)},
getDashboardResults:function(a,b){var d=this._successHandler,g=this._errorHandler,h=this._appendQueryParams,c=new n,l,e;null===b||void 0===b?(e=this._url+"/Dashboard/reviewerResultsBy/"+a,l={f:"json"}):(e=this._url+"/Dashboard/reviewerResultsBy/"+a+"/filter",l={f:"json",filtersArray:b.toJSON()});e=h(e);p({callbackParamName:"callback",url:e,content:l}).then(k.hitch(this,function(f,e){if(void 0!==f.error){var a=Error();a.message=f.error.message;a.code=f.error.code;g(a,c)}else try{if(void 0===f.dashboardResults)g(null,
c);else{var b=new t;m.forEach(f.dashboardResults,function(a,c){b.fieldValues.push(a.fieldValue);b.counts.push(a.count)});b.fieldName=f.fieldName;a=new u;a.createFromJsonObject(f);b.filters=a;d({dashboardResult:b},"onGetDashboardResultsComplete",c)}}catch(x){g(x,c)}}),function(a,b){g(a,c)});return c},getDashboardFieldNames:function(){var a=this._successHandler,b=this._errorHandler,d=this._appendQueryParams,g=this._url+"/Dashboard",g=d(g),h=new n;p({callbackParamName:"callback",url:g,content:{f:"json"}}).then(k.hitch(this,
function(c,d){if(void 0!==c.error){var e=Error();e.message=c.error.message;e.code=c.error.code;b(e,h)}else try{var f=[];m.forEach(c.reviewerResultsBy,function(a,b){f.push(a.name)});a({fieldNames:f},"onGetDashboardFieldNamesComplete",h)}catch(w){b(w,h)}}),function(a,d){b(a,h)});return h},onGetDashboardResultsComplete:function(a){},onGetDashboardFieldNamesComplete:function(a){}});q("extend-esri")&&k.setObject("tasks.datareviewer.DashboardTask",d,v);return d});