/**
 * Create new geometries using the topological intersection of 2D geometries.
 *
 * ![Intersection operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/intersection.png "Intersection operator")
 *
 * @since 4.31
 */
import type { GeometryUnion, GeometryWithoutMeshUnion } from "../types.js";

/**
 * Accelerate a geometry. This method prepares the geometry for faster intersection operations when the same geometry is tested multiple times (e.g. in a loop with hundreds of iterations). See the [Acceleration](https://developers.arcgis.com/javascript/latest/spatial-analysis/intro-geometry-operators/#acceleration) guide topic for more information.
 *
 * @param geometry - The geometry to accelerate.
 * @returns Returns `true` if the geometry was successfully accelerated.
 */
export function accelerateGeometry(geometry: GeometryUnion): boolean;

/**
 * Performs the topological intersection operation on two geometries.
 *
 * If the input geometries have different dimensions (i.e. point = 0; polyline = 1; polygon = 2),
 * then the result's dimension will be equal to the lowest dimension of the inputs.
 *
 * The table below describes the expected output for various combinations of geometry
 * types. Note that the geometries are interchangeable in this operation
 * and will return the same result if flipped.
 *
 * `geometry1` type | `geometry2` type | Result geometry type
 * --------------|---------------------------|---------------------
 * Polygon/Extent | Polygon/Extent | Polygon
 * Polygon/Extent | Polyline | Polyline
 * Polygon | Point | Point
 * Polygon | Multipoint | Multipoint
 * Polyline | Polyline | Polyline
 * Polyline | Point | Point
 * Polyline | Multipoint | Multipoint
 * Point | Point | Point
 * Multipoint | Multipoint | Multipoint
 *
 * Note that two intersecting polylines will not return point geometries. Instead, this operator will return polyline paths that are equal or overlap between the two geometries. See [executyMany()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/intersectionOperator/#executeMany) to find the point intersections of two polylines.
 *
 * @param geometry1 - The geometry to intersect with  `geometry2`.
 * @param geometry2 - The geometry to intersect with `geometry1`.
 * @returns Returns the result of the intersection of the two geometries or null.
 * @example
 * // Creates a new geometry based on the intersection of two polygons
 * const intersection = intersectionOperator.execute(polygon1, polygon2);
 */
export function execute(geometry1: GeometryUnion, geometry2: GeometryUnion): GeometryWithoutMeshUnion | null | undefined;

/**
 * Performs the topological intersection operation on the geometry set.
 *
 * The table below describes the potential results for various combinations of geometry
 * types based on how they intersect. For example, a polyline that touches a polygon would return a multipoint.
 * If the geometries do not intersect, an empty array will be returned.
 *
 * Input geometry type | Intersector geometry type | Result geometry types
 * --------------|---------------------------|---------------------
 * Point/Multipoint | Point/Multipoint | Multipoint
 * Point/Multipoint | Polyline | Multipoint
 * Point/Multipoint | Polygon/Extent | Multipoint
 * Polyline | Point, Multipoint | Multipoint
 * Polyline | Polyline | Polyline, Multipoint
 * Polyline | Polygon/Extent | Polyline, Multipoint
 * Polygon/Extent | Point/Multipoint | Multipoint
 * Polygon/Extent | Polyline | Multipoint, Polyline
 * Polygon/Extent | Polygon/Extent | Multipoint, Polyline, Polygon
 *
 * @param geometries - The set of input geometries to be intersected by the `intersector`.
 * All the geometries must have the same spatial reference.
 * @param intersector - The geometry to intersect with the `geometries`.
 * @returns Returns an array of geometries created by intersecting
 * every geometry in the input geometries with the `intersector`, or an empty array if there is no intersection.
 */
export function executeMany(geometries: GeometryUnion[], intersector: GeometryUnion): GeometryWithoutMeshUnion[];

/**
 * Indicates if the operator supports input geometries that contain curves.
 * The value will always be `true`.
 */
export const supportsCurves: boolean;