/**
 * Returns the geodetic area of a 2D geometry.
 *
 * > [!WARNING]
 * >
 * > **Notes**
 * >
 * > Verify that `isLoaded()` returns `true` before using this module.
 * > Use `load()` to load this module's dependencies.
 *
 * @since 4.31
 */
import type { AreaUnit } from "../../core/units.js";
import type { GeometryUnion, GeodeticCurveType } from "../types.js";

export interface Options {
  /**
   * The type of geodetic curve used to determine the area.
   *
   * @default "geodesic"
   */
  curveType?: GeodeticCurveType;
  /**
   * The area unit of the return value.
   *
   * @default "square-meters"
   */
  unit?: AreaUnit;
}

/**
 * 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/references/core/geometry/operators/geodeticAreaOperator/#isLoaded)
 */
export function load(): Promise<void>;

/**
 * Calculates the geodetic area of the input Geometry.
 * Unless the `unit` option is set, the default is square-meters.
 *
 * @param geometry - The input geometry.
 * @param options - Additional options.
 * @returns Returns the geodetic area of the input geometry.
 * @example
 * if (!geodeticAreaOperator.isLoaded()) {
 *   await geodeticAreaOperator.load();
 * }
 *
 * // Calculate the geodetic area of a polygon.
 * const area = geodeticAreaOperator.execute(polygon);
 */
export function execute(geometry: GeometryUnion, options?: Options): number;

/**
 * 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`.
 */
export const supportsCurves: boolean | null | undefined;