/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import e from"../../request.js";import{deprecatedProperty as t}from"../../core/deprecate.js";import o from"../../core/Logger.js";import{associationTypeKebabDict as r}from"../../networks/support/typeUtils.js";import{parseUrl as n,encode as s,asValidOptions as i}from"../utils.js";import c from"./support/QueryAssociationsResult.js";function a(e){const{returnDeletes:t,elements:o,gdbVersion:n,moment:s}=e.toJSON();return{returnDeletes:t,elements:JSON.stringify(o.map(e=>({globalId:e.globalId,networkSourceId:e.networkSourceId,terminalId:e.terminalId}))),types:JSON.stringify(e.types.map(e=>r.toJSON(e))).replaceAll('"connectivity"','"junctionJunctionConnectivity"'),gdbVersion:n,moment:s??Date.now()}}async function p(r,p,m){const u=n(r),l={...a(p),f:"json"},y=s({...u.query,...l}),d=i(y,{...m,method:"post"}),f=`${u.path}/associations/query`,{data:g}=await e(f,d),j=c.fromJSON(g);return p.types.includes("connectivity")&&t(o.getLogger("esri/rest/networks/support/QueryAssociationsParameters"),"types",{replacement:"Please use 'junction-junction-connectivity' instead of 'connectivity'.",see:"https://arcg.is/11Tr8a#types",version:"4.29",warnOnce:!0}),j}export{p as queryAssociations};
