/*
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","../../geometry/Polyline","../route/utils","./networkEnums"],(function(e,t,r,o,a,i,s,l,p,n,c,d,u,y,b,m,T){"use strict";var _;let 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="polyline-barrier",r}e._inheritsLoose(o,t);var a=o.prototype;return a.readCosts=function(e,t){return m.getPrefixedProperties(t.attributes,"Attr_")},o.fromGraphic=function(e){var t,r;return new _({barrierType:l.isSome(e.attributes.BarrierType)?T.barrierTypeJsonMap.fromJSON(e.attributes.BarrierType):null,costs:l.isSome(e.attributes.Costs)?m.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(){const e={__OBJECTID:l.unwrap(this.objectId),BarrierType:l.isSome(this.barrierType)?T.barrierTypeJsonMap.toJSON(this.barrierType):null,Costs:l.isSome(this.costs)?JSON.stringify(m.fromKebabImpedanceAttributes(this.costs)):null,Name:this.name,ScaleFactor:this.scaleFactor};return new r({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})},o}(i.ClonableMixin(s.JSONSupport));S.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}],S.popupInfo={title:"Line 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:T.barrierTypeJsonMap.apiValues,json:{read:{source:"attributes.BarrierType",reader:T.barrierTypeJsonMap.read}}})],S.prototype,"barrierType",void 0),t.__decorate([p.property()],S.prototype,"costs",void 0),t.__decorate([u.reader("costs",["attributes"])],S.prototype,"readCosts",null),t.__decorate([p.property({type:b,json:{write:!0}})],S.prototype,"geometry",void 0),t.__decorate([p.property({json:{name:"attributes.Name"}})],S.prototype,"name",void 0),t.__decorate([p.property({json:{name:"attributes.ObjectID"}})],S.prototype,"objectId",void 0),t.__decorate([p.property({type:o,json:{read:!1}})],S.prototype,"popupTemplate",void 0),t.__decorate([p.property({json:{read:!1}})],S.prototype,"scaleFactor",void 0),t.__decorate([p.property({types:a.symbolTypes,json:{read:!1}})],S.prototype,"symbol",void 0),t.__decorate([p.property({readOnly:!0,json:{read:!1}})],S.prototype,"type",void 0),S=_=t.__decorate([y.subclass("esri.rest.support.PolylineBarrier")],S);return S}));
