/*
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","../../core/jsonMap","../../core/JSONSupport","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../geometry/Polygon"],(function(e,r,t,s,o,i,n,a,p,l){"use strict";const c=new t.JSONMap({preserveShape:"preserve-shape",planar:"planar",geodesic:"geodesic"}),u=new t.JSONMap({esriAcres:"acres",esriHectares:"hectares",esriSquareMiles:"square-miles",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareFeet:"square-feet",esriSquareYards:"square-yards",esriAres:"ares"}),y=new t.JSONMap({9001:"meters",9002:"feet",9036:"kilometers",9093:"miles",109012:"nautical-miles",109001:"yards"});let S=function(r){function t(e){var t;return(t=r.call(this,e)||this).areaUnit=null,t.calculationType=null,t.lengthUnit=null,t.polygons=null,t}return e._inheritsLoose(t,r),t.prototype.toJSON=function(){const e={};if(this.polygons&&this.polygons.length>0){const r=this.polygons.map((e=>e.toJSON()));e.polygons=JSON.stringify(r);const t=this.polygons[0].spatialReference;e.sr=t.wkid?t.wkid:JSON.stringify(t.toJSON())}if(this.lengthUnit&&(e.lengthUnit=y.toJSON(this.lengthUnit)),this.areaUnit){const r=u.toJSON(this.areaUnit);e.areaUnit="string"==typeof r?JSON.stringify({areaUnit:r}):r}return this.calculationType&&(e.calculationType=c.toJSON(this.calculationType)),e},t}(s.JSONSupport);r.__decorate([o.property({type:String,json:{write:!0}})],S.prototype,"areaUnit",void 0),r.__decorate([o.property({type:String,json:{write:!0}})],S.prototype,"calculationType",void 0),r.__decorate([o.property({type:String,json:{write:!0}})],S.prototype,"lengthUnit",void 0),r.__decorate([o.property({type:[l],json:{write:!0}})],S.prototype,"polygons",void 0),S=r.__decorate([p.subclass("esri.rest.support.AreasAndLengthsParameters")],S);return S}));
