/*
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{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as e,subclass as r}from"../../../core/accessorSupport/decorators.js";import n from"../../../geometry/Polyline.js";import{associationTypeKebabDict as i,nullGuid as l}from"../../../networks/support/typeUtils.js";import m from"./NetworkElement.js";import s from"./TelecomNetworkElement.js";import{reader as d}from"../../../core/accessorSupport/decorators/reader.js";import{writer as u}from"../../../core/accessorSupport/decorators/writer.js";let a=class extends o{constructor(t){super(t),this.globalId=null,this.associationType=null,this.fromNetworkElement=null,this.toNetworkElement=null,this.geometry=null,this.errorMessage=null,this.percentAlong=null,this.errorCode=null,this.isContentVisible=null,this.status=null}readFromNetworkElement(t,o){return o.fromFirstUnit||o.fromNumUnits?new s({globalId:o.fromGlobalId,networkSourceId:o.fromNetworkSourceId,terminalId:o.fromTerminalId,firstUnit:o.fromFirstUnit,numUnits:o.fromNumUnits}):new m({globalId:o.fromGlobalId,networkSourceId:o.fromNetworkSourceId,terminalId:o.fromTerminalId})}writeFromNetworkElement(t,o){if(t&&(o.fromGlobalId=t.globalId,o.fromNetworkSourceId=t.networkSourceId,o.fromTerminalId=t.terminalId,"telecomNetworkElement"===t.type)){const e=t;o.fromFirstUnit=e.firstUnit,o.fromNumUnits=e.numUnits}}readToNetworkElement(t,o){return o.toFirstUnit||o.toNumUnits?new s({globalId:o.toGlobalId,networkSourceId:o.toNetworkSourceId,terminalId:o.toTerminalId,firstUnit:o.toFirstUnit,numUnits:o.toNumUnits}):new m({globalId:o.toGlobalId,networkSourceId:o.toNetworkSourceId,terminalId:o.toTerminalId})}writeToNetworkElement(t,o){if(t&&(o.toGlobalId=t.globalId,o.toNetworkSourceId=t.networkSourceId,o.toTerminalId=t.terminalId,"telecomNetworkElement"===t.type)){const e=t;o.toFirstUnit=e.firstUnit,o.toNumUnits=e.numUnits}}equals(t){if(this.globalId===l&&t.globalId===l){function o(t,o){return t.networkSourceId===o.networkSourceId&&t.globalId===o.globalId&&t.terminalId===o.terminalId&&t.firstUnit===o.firstUnit&&t.numUnits===o.numUnits}const e=this.fromNetworkElement,r=this.toNetworkElement,n=t.fromNetworkElement,i=t.toNetworkElement,m=o(e,n),s=o(r,i);return m&&s&&this.associationType===t.associationType}return null!=this.globalId&&null!=t.globalId&&this.globalId===t.globalId}};t([e({type:String,json:{write:!0}})],a.prototype,"globalId",void 0),t([e({type:i.apiValues,json:{type:i.jsonValues,read:i.read,write:i.write}})],a.prototype,"associationType",void 0),t([e({type:m,json:{write:{target:{fromGlobalId:{type:String},fromNetworkSourceId:{type:Number},fromTerminalId:{type:Number},fromFirstUnit:{type:Number},fromNumUnits:{type:Number}}},read:{source:["fromGlobalId","fromNetworkSourceId","fromTerminalId","fromFirstUnit","fromNumUnits"]}}})],a.prototype,"fromNetworkElement",void 0),t([d("fromNetworkElement")],a.prototype,"readFromNetworkElement",null),t([u("fromNetworkElement")],a.prototype,"writeFromNetworkElement",null),t([e({type:m,json:{write:{target:{toGlobalId:{type:String},toNetworkSourceId:{type:Number},toTerminalId:{type:Number},toFirstUnit:{type:Number},toNumUnits:{type:Number}}},read:{source:["toGlobalId","toNetworkSourceId","toTerminalId","toFirstUnit","toNumUnits"]}}})],a.prototype,"toNetworkElement",void 0),t([d("toNetworkElement")],a.prototype,"readToNetworkElement",null),t([u("toNetworkElement")],a.prototype,"writeToNetworkElement",null),t([e({type:n,json:{write:!0}})],a.prototype,"geometry",void 0),t([e({type:String,json:{write:!0}})],a.prototype,"errorMessage",void 0),t([e({type:Number,json:{write:!0}})],a.prototype,"percentAlong",void 0),t([e({type:Number,json:{write:!0}})],a.prototype,"errorCode",void 0),t([e({type:Boolean,json:{write:!0}})],a.prototype,"isContentVisible",void 0),t([e({type:Number,json:{write:!0}})],a.prototype,"status",void 0),a=t([r("esri.rest.networks.support.Association")],a);const p=a;export{p as default};
