/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../request","../../core/JSONSupport","../../core/Loadable","../../core/Logger","../../core/maybe","../../core/Promise","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass"],(function(e,r,t,o,s,i,n,a,l,p,u,c,y){"use strict";const d=i.getLogger("esri.layers.support.BuildingSummaryStatistics");let m=function(r){function t(){var e;return(e=r.apply(this,arguments)||this).fieldName=null,e.modelName=null,e.label=null,e.min=null,e.max=null,e.mostFrequentValues=null,e.subLayerIds=null,e}return e._inheritsLoose(t,r),t}(o.JSONSupport);r.__decorate([l.property({type:String})],m.prototype,"fieldName",void 0),r.__decorate([l.property({type:String})],m.prototype,"modelName",void 0),r.__decorate([l.property({type:String})],m.prototype,"label",void 0),r.__decorate([l.property({type:Number})],m.prototype,"min",void 0),r.__decorate([l.property({type:Number})],m.prototype,"max",void 0),r.__decorate([l.property({json:{read:e=>Array.isArray(e)&&(e.every((e=>"string"==typeof e))||e.every((e=>"number"==typeof e)))?e.slice():null}})],m.prototype,"mostFrequentValues",void 0),r.__decorate([l.property({type:[Number]})],m.prototype,"subLayerIds",void 0),m=r.__decorate([y.subclass("esri.layers.support.BuildingFieldStatistics")],m);let _=function(r){function o(){var e;return(e=r.apply(this,arguments)||this).url=null,e}e._inheritsLoose(o,r);var s=o.prototype;return s.load=function(e){const r=n.isSome(e)?e.signal:null;return this.addResolvingPromise(this._fetchService(r)),Promise.resolve(this)},s._fetchService=function(){var r=e._asyncToGenerator((function*(e){const r=(yield t(this.url,{query:{f:"json"},responseType:"json",signal:e})).data;this.read(r,{origin:"service"})}));function o(e){return r.apply(this,arguments)}return o}(),e._createClass(o,[{key:"fields",get:function(){return this.loaded||"loading"===this.loadStatus?this._get("fields"):(d.error("building summary statistics are not loaded"),null)}}]),o}(s.LoadableMixin(a.EsriPromiseMixin(o.JSONSupport)));r.__decorate([l.property({constructOnly:!0,type:String})],_.prototype,"url",void 0),r.__decorate([l.property({readOnly:!0,type:[m],json:{read:{source:"summary"}}})],_.prototype,"fields",null),_=r.__decorate([y.subclass("esri.layers.support.BuildingSummaryStatistics")],_);return _}));
