/*
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","../../Graphic","../../PopupTemplate","../../symbols","../../core/Clonable","../../core/JSONSupport","../../core/maybe","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/reader","../../core/accessorSupport/decorators/subclass","../../core/accessorSupport/decorators/writer","../../geometry/Polygon","../route/utils","./networkEnums"],(function(e,t,r,o,a,i,s,l,p,n,c,u,d,y,b,m,T,_){"use strict";var S;let f=S=function(t){function o(e){var r;return(r=t.call(this,e)||this).barrierType=null,r.costs=null,r.geometry=null,r.name=null,r.objectId=null,r.popupTemplate=null,r.scaleFactor=null,r.symbol=null,r.type="polygon-barrier",r}e._inheritsLoose(o,t);var a=o.prototype;return a.readCosts=function(e,t){return T.getPrefixedProperties(t.attributes,"Attr_")},a.writeCosts=function(e,t){T.setPrefixedProperties(e,t,"Attr_")},o.fromGraphic=function(e){var t,r;return new S({barrierType:l.isSome(e.attributes.BarrierType)?_.barrierTypeJsonMap.fromJSON(e.attributes.BarrierType):null,costs:l.isSome(e.attributes.Costs)?T.toKebabImpedanceAttributes(JSON.parse(e.attributes.Costs)):null,geometry:e.geometry,name:null!=(t=e.attributes.Name)?t:null,objectId:e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,scaleFactor:null!=(r=e.attributes.ScaleFactor)?r:null,symbol:e.symbol})},a.toGraphic=function(){var e,t;const o={__OBJECTID:l.unwrap(this.objectId),BarrierType:l.isSome(this.barrierType)?_.barrierTypeJsonMap.toJSON(this.barrierType):null,Costs:l.isSome(this.costs)?JSON.stringify(T.fromKebabImpedanceAttributes(this.costs)):null,Name:null!=(e=this.name)?e:null,ScaleFactor:null!=(t=this.scaleFactor)?t:null};return new r({geometry:this.geometry,attributes:o,symbol:this.symbol,popupTemplate:this.popupTemplate})},o}(i.ClonableMixin(s.JSONSupport));f.fields=[{name:"__OBJECTID",alias:"OBJECTID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNABarrierType",codedValues:[{name:"Restriction",code:0},{name:"Scaled Cost",code:1},{name:"Added Cost",code:2}]}},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"ScaleFactor",alias:"Scale Factor",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0}],f.popupInfo={title:"Polygon Barriers",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BarrierType",label:"Barrier Type",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ScaleFactor",isEditable:!0,tooltip:"",visible:!0,format:{places:3,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Costs",label:"Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t.__decorate([p.property({type:_.barrierTypeJsonMap.apiValues,json:{name:"attributes.BarrierType",read:{reader:_.barrierTypeJsonMap.read},write:{writer:_.barrierTypeJsonMap.write}}})],f.prototype,"barrierType",void 0),t.__decorate([p.property()],f.prototype,"costs",void 0),t.__decorate([d.reader("costs",["attributes"])],f.prototype,"readCosts",null),t.__decorate([b.writer("costs")],f.prototype,"writeCosts",null),t.__decorate([p.property({type:m,json:{write:!0}})],f.prototype,"geometry",void 0),t.__decorate([p.property({json:{name:"attributes.Name"}})],f.prototype,"name",void 0),t.__decorate([p.property({json:{name:"attributes.ObjectID"}})],f.prototype,"objectId",void 0),t.__decorate([p.property({type:o,json:{read:!1}})],f.prototype,"popupTemplate",void 0),t.__decorate([p.property({json:{read:!1}})],f.prototype,"scaleFactor",void 0),t.__decorate([p.property({types:a.symbolTypes,json:{read:!1}})],f.prototype,"symbol",void 0),t.__decorate([p.property({readOnly:!0,json:{read:!1}})],f.prototype,"type",void 0),f=S=t.__decorate([y.subclass("esri.rest.support.PolygonBarrier")],f);return f}));
