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