/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{JSONMap as e}from"../../core/jsonMap.js";import{getJsonType as t}from"../../geometry/support/jsonTypeUtils.js";import{srToRESTValue as o}from"../../geometry/support/spatialReferenceUtils.js";const i=new e({esriGeometryRelationCross:"cross",esriGeometryRelationDisjoint:"disjoint",esriGeometryRelationIn:"in",esriGeometryRelationInteriorIntersection:"interior-intersection",esriGeometryRelationIntersection:"intersection",esriGeometryRelationLineCoincidence:"line-coincidence",esriGeometryRelationLineTouch:"line-touch",esriGeometryRelationOverlap:"overlap",esriGeometryRelationPointTouch:"point-touch",esriGeometryRelationTouch:"touch",esriGeometryRelationWithin:"within",esriGeometryRelationRelation:"relation"});function r(e){const{geometries1:r,geometries2:n,relation:s,relationParameter:m}=e.toJSON(),a={};return r?.length&&(a.geometries1=JSON.stringify({geometryType:t(r[0]),geometries:r}),a.sr=o(r[0].spatialReference)),n&&n.length>0&&(a.geometries2=JSON.stringify({geometryType:t(n[0]),geometries:n})),s&&(a.relation=i.toJSON(s)),m&&(a.relationParam=m),a}export{r as relationToRESTParameters};
