/**
 * Densifies line segments by length in a 2D plane, making them run along specified geodetic curves. There are no segments longer than the specified maximum segment length.
 *
 * > [!WARNING]
 * >
 * > **Notes**
 * >
 * > If you have an area of interest such as a visible extent, clip the input geometries before densifying to limit the amount of segments produced.
 * > Verify that `isLoaded()` returns `true` before using this module.
 * > Use `load()` to load this module's dependencies.
 *
 * @since 4.31
 */
import type { LengthUnit } from "../../core/units.js";
import type { GeometryUnion, GeometryWithoutMeshUnion, GeodeticCurveType } from "../types.js";

export interface Options {
  /**
   * The type of geodetic curve used to densify the geometries.
   *
   * @default "geodesic"
   */
  curveType?: GeodeticCurveType;
  /**
   * The length unit of `maxSegmentLength`.
   *
   * @default "meters"
   */
  unit?: LengthUnit;
}

/**
 * Indicates if all dependencies of this module have been loaded.
 *
 * @returns Returns `true` if this module's dependencies have been loaded.
 */
export function isLoaded(): boolean;

/**
 * Loads this module's dependencies. This method must be called first if `isLoaded` returns `false`.
 *
 * @returns Resolves when the dependencies have been loaded.
 * @see [isLoaded()](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-operators-geodeticDensifyOperator.html#isLoaded)
 */
export function load(): Promise<void>;

/**
 * Densifies the input geometry.
 *
 * @param geometry - The input geometry to be densified.
 * @param maxSegmentLength - The maximum segment length allowed. Unless the `unit` option is set, the default is meters. Must be a positive value.
 * @param options - Additional options.
 * @returns Returns the densified geometry or null. Geometries with a dimension of < 1 are simply passed along.
 * @example
 * if (!geodeticDensifyOperator.isLoaded()) {
 *   await geodeticDensifyOperator.load();
 * }
 *
 * // Densify a polyline geometry
 * const densifiedPolyline = geodeticDensifyOperator.execute(polyline, 100);
 */
export function execute(geometry: GeometryUnion, maxSegmentLength: number, options?: Options): GeometryWithoutMeshUnion | null | undefined;

/**
 * Densifies the input geometries.
 *
 * @param geometries - The set of geometries to be densified.
 * All the geometries must have the same spatial reference.
 * @param maxSegmentLength - The maximum segment length allowed. Unless the `unit` option is set, the default is meters. Must be a positive value.
 * @param options - Additional options.
 * @returns Returns an array whose elements may either be densified geometries or null.
 */
export function executeMany(geometries: GeometryUnion[], maxSegmentLength: number, options?: Options): (GeometryWithoutMeshUnion | null | undefined)[];

/**
 * Indicates if the operator supports input geometries that contain curves.
 * The value is `null` or `undefined` until the operator is loaded, then it will always be `true`.
 * This will produce densified output geometries.
 */
export const supportsCurves: boolean | null | undefined;