/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import{ClonableMixin as o}from"../../core/Clonable.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{property as a,subclass as i}from"../../core/accessorSupport/decorators.js";import l from"../../geometry/Polyline.js";import{getPrefixedProperties as p,toKebabImpedanceAttributes as m,fromKebabImpedanceAttributes as u}from"../route/utils.js";import{barrierTypeJsonMap as n}from"./networkEnums.js";import{symbolTypes as y}from"../../symbols/support/typeUtils.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";var b;let d=class extends(o(s)){static{b=this}constructor(e){super(e),this.barrierType=null,this.costs=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.scaleFactor=null,this.symbol=null,this.type="polyline-barrier"}readCosts(e,t){return p(t.attributes,"Attr_")}static{this.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",editable:!0,nullable:!0,length:1048576},{name:"Name",alias:"Name",type:"esriFieldTypeString",editable:!0,nullable:!0,length:255},{name:"ScaleFactor",alias:"Scale Factor",type:"esriFieldTypeDouble",editable:!0,nullable:!0}]}static fromGraphic(e){return new b({barrierType:null!=e.attributes.BarrierType?n.fromJSON(e.attributes.BarrierType):null,costs:null!=e.attributes.Costs?m(JSON.parse(e.attributes.Costs)):null,geometry:e.geometry,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,scaleFactor:e.attributes.ScaleFactor??null,symbol:e.symbol})}toGraphic(){const e={ObjectID:this.objectId,BarrierType:this.barrierType?n.toJSON(this.barrierType):null,Costs:this.costs?JSON.stringify(u(this.costs)):null,Name:this.name,ScaleFactor:this.scaleFactor};return new t({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};e([a({type:n.apiValues,json:{read:{source:"attributes.BarrierType",reader:n.read}}})],d.prototype,"barrierType",void 0),e([a()],d.prototype,"costs",void 0),e([c("costs",["attributes"])],d.prototype,"readCosts",null),e([a({type:l,json:{write:!0}})],d.prototype,"geometry",void 0),e([a({json:{name:"attributes.Name"}})],d.prototype,"name",void 0),e([a({json:{name:"attributes.ObjectID"}})],d.prototype,"objectId",void 0),e([a({type:r})],d.prototype,"popupTemplate",void 0),e([a()],d.prototype,"scaleFactor",void 0),e([a({types:y})],d.prototype,"symbol",void 0),e([a({readOnly:!0,json:{read:!1}})],d.prototype,"type",void 0),d=b=e([i("esri.rest.support.PolylineBarrier")],d);export{d as default};
