/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t}from"tslib";import{EventedMixin as e}from"../../core/Evented.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{on as i}from"../../core/reactiveUtils.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import{subcircuitStateKebabDict as a}from"./typeUtils.js";let p=class extends(e(r)){constructor(t){super(t),this.name=null,this.globalId=null,this.providerId=null,this.consumerId=null,this.state="available",this.attributes=null,this._updateHandler=t=>{const{subcircuitGlobalId:e,name:r,subcircuit:i}=t;(e&&this.globalId===e||this.name===r)&&this.read(i)}}initialize(){this.addHandles([i(()=>this,"update",this._updateHandler)])}getAttribute(t){return this.attributes?.[t]}setAttribute(t,e){this.attributes?this.attributes[t]=e:this.attributes={[t]:e}}};t([s({type:String,json:{write:!0}})],p.prototype,"name",void 0),t([s({type:String,json:{write:!0}})],p.prototype,"globalId",void 0),t([s({type:String})],p.prototype,"providerId",void 0),t([s({type:String})],p.prototype,"consumerId",void 0),t([s({type:a.apiValues,json:{type:a.jsonValues,read:{reader:a.read,source:"state"},write:{writer:a.write,target:"state"}}})],p.prototype,"state",void 0),t([s({json:{write:{allowNull:!0,writer:(t,e)=>e.attributes=t??{}}}})],p.prototype,"attributes",void 0),p=t([o("esri.networks.support.Subcircuit")],p);export{p as default};
