/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import r from"../../PopupTemplate.js";import{ClonableMixin as s}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as i,subclass as l}from"../../core/accessorSupport/decorators.js";import a from"../../geometry/Point.js";import{getPrefixedProperties as p,setPrefixedProperties as u,toKebabImpedanceAttributes as n,fromKebabImpedanceAttributes as d}from"../route/utils.js";import{statusJsonMap as b,fullEdgeJsonMap as m,curbApproachJsonMap as y,barrierTypeJsonMap as c,sideOfEdgeJsonMap as h}from"./networkEnums.js";import{symbolTypes as g}from"../../symbols/support/typeUtils.js";import{reader as j}from"../../core/accessorSupport/decorators/reader.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";var O;let T=class extends(s(o)){static{O=this}constructor(t){super(t),this.addedCost=null,this.barrierType=null,this.costs=null,this.curbApproach=null,this.fullEdge=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.positionAlong=null,this.sideOfEdge=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.type="point-barrier"}readCosts(t,e){return p(e.attributes,"Attr_")}writeCosts(t,e){u(t,e,"Attr_")}set geometry(t){this._get("geometry")&&(this._set("positionAlong",null),this._set("sideOfEdge",null),this._set("sourceId",null),this._set("sourceOid",null),this._set("status",null)),this._set("geometry",t)}static{this.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1},{name:"AddedCost",alias:"Added Cost",type:"esriFieldTypeDouble",editable:!0,nullable:!0},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",editable:!0,nullable:!0,length:1048576},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0},{name:"FullEdge",alias:"Full Edge",type:"esriFieldTypeInteger",editable:!0,nullable:!0},{name:"Name",alias:"Name",type:"esriFieldTypeString",editable:!0,nullable:!0,length:255},{name:"Status",alias:"Status",type:"esriFieldTypeInteger",editable:!0,nullable:!0}]}static fromGraphic(t){return new O({addedCost:t.attributes.AddedCost??null,barrierType:null!=t.attributes.BarrierType?c.fromJSON(t.attributes.BarrierType):null,costs:null!=t.attributes.Costs?n(JSON.parse(t.attributes.Costs)):null,curbApproach:null!=t.attributes.CurbApproach?y.fromJSON(t.attributes.CurbApproach):null,fullEdge:null!=t.attributes.FullEdge?m.fromJSON(t.attributes.FullEdge):null,geometry:t.geometry,name:t.attributes.Name??null,objectId:t.attributes.ObjectID??t.attributes.__OBJECTID,popupTemplate:t.popupTemplate,status:null!=t.attributes.Status?b.fromJSON(t.attributes.Status):null,symbol:t.symbol})}toGraphic(){const t={ObjectID:this.objectId,AddedCost:this.addedCost,BarrierType:this.barrierType?c.toJSON(this.barrierType):null,Costs:this.costs?JSON.stringify(d(this.costs)):null,CurbApproach:this.curbApproach?y.toJSON(this.curbApproach):null,FullEdge:this.fullEdge?m.toJSON(this.fullEdge):null,Name:this.name,Status:this.status?b.toJSON(this.status):null};return new e({geometry:this.geometry,attributes:t,symbol:this.symbol,popupTemplate:this.popupTemplate})}};t([i()],T.prototype,"addedCost",void 0),t([i({type:c.apiValues,json:{name:"attributes.BarrierType",read:{reader:c.read},write:{writer:c.write}}})],T.prototype,"barrierType",void 0),t([i()],T.prototype,"costs",void 0),t([j("costs",["attributes"])],T.prototype,"readCosts",null),t([f("costs")],T.prototype,"writeCosts",null),t([i({type:y.apiValues,json:{read:{source:"attributes.CurbApproach",reader:y.read}}})],T.prototype,"curbApproach",void 0),t([i({type:m.apiValues,json:{name:"attributes.FullEdge",read:{reader:m.read},write:{writer:m.write}}})],T.prototype,"fullEdge",void 0),t([i({type:a,json:{write:!0},value:null})],T.prototype,"geometry",null),t([i({json:{name:"attributes.Name"}})],T.prototype,"name",void 0),t([i({json:{name:"attributes.ObjectID"}})],T.prototype,"objectId",void 0),t([i({type:r})],T.prototype,"popupTemplate",void 0),t([i({json:{name:"attributes.PosAlong"}})],T.prototype,"positionAlong",void 0),t([i({type:h.apiValues,json:{name:"attributes.SideOfEdge",read:{reader:h.read},write:{writer:h.write}}})],T.prototype,"sideOfEdge",void 0),t([i({json:{name:"attributes.SourceID"}})],T.prototype,"sourceId",void 0),t([i({json:{name:"attributes.SourceOID"}})],T.prototype,"sourceOid",void 0),t([i({type:b.apiValues,json:{read:{source:"attributes.Status",reader:b.read}}})],T.prototype,"status",void 0),t([i({types:g})],T.prototype,"symbol",void 0),t([i({readOnly:!0,json:{read:!1}})],T.prototype,"type",void 0),T=O=t([l("esri.rest.support.PointBarrier")],T);export{T as default};
