/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import e 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 p,subclass as i}from"../../core/accessorSupport/decorators.js";import a from"../../geometry/Polyline.js";import{getPrefixedProperties as l,toKebabImpedanceAttributes as m,fromKebabImpedanceAttributes as y}from"../route/utils.js";import{barrierTypeJsonMap as u}from"./networkEnums.js";import{symbolTypes as c}from"../../symbols/support/typeUtils.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";var b;let d=class extends(o(s)){static{b=this}constructor(t){super(t),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(t,e){return l(e.attributes,"Attr_")}static{this.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID"},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger"},{name:"Costs",alias:"Costs",type:"esriFieldTypeString"},{name:"Name",alias:"Name",type:"esriFieldTypeString"},{name:"ScaleFactor",alias:"Scale Factor",type:"esriFieldTypeDouble"}]}static fromGraphic(t){return new b({barrierType:null!=t.attributes.BarrierType?u.fromJSON(t.attributes.BarrierType):null,costs:null!=t.attributes.Costs?m(JSON.parse(t.attributes.Costs)):null,geometry:t.geometry,name:t.attributes.Name??null,objectId:t.attributes.ObjectID??t.attributes.__OBJECTID,popupTemplate:t.popupTemplate,scaleFactor:t.attributes.ScaleFactor??null,symbol:t.symbol})}toGraphic(){const t={ObjectID:this.objectId,BarrierType:this.barrierType?u.toJSON(this.barrierType):null,Costs:this.costs?JSON.stringify(y(this.costs)):null,Name:this.name,ScaleFactor:this.scaleFactor};return new e({geometry:this.geometry,attributes:t,symbol:this.symbol,popupTemplate:this.popupTemplate})}};t([p({type:u.apiValues,json:{read:{source:"attributes.BarrierType",reader:u.read}}})],d.prototype,"barrierType",void 0),t([p()],d.prototype,"costs",void 0),t([n("costs",["attributes"])],d.prototype,"readCosts",null),t([p({type:a,json:{write:!0}})],d.prototype,"geometry",void 0),t([p({json:{name:"attributes.Name"}})],d.prototype,"name",void 0),t([p({json:{name:"attributes.ObjectID"}})],d.prototype,"objectId",void 0),t([p({type:r})],d.prototype,"popupTemplate",void 0),t([p()],d.prototype,"scaleFactor",void 0),t([p({types:c})],d.prototype,"symbol",void 0),t([p({readOnly:!0,json:{read:!1}})],d.prototype,"type",void 0),d=b=t([i("esri.rest.support.PolylineBarrier")],d);export{d as default};
