import type ElevationProfileLineGround from "./ElevationProfileLineGround.js";
import type ElevationProfileLineInput from "./ElevationProfileLineInput.js";
import type ElevationProfileLineQuery from "./ElevationProfileLineQuery.js";
import type ElevationProfileLineView from "./ElevationProfileLineView.js";
import type { LengthUnit } from "../../core/units.js";
import type { ElevationQueryGeometry, ElevationQueryResult, ElevationQueryOptions } from "../../layers/support/types.js";

/**
 * The public state (mostly related to interaction) the elevation profile can be in.
 *
 * - disabled: widget is being created
 * - ready: widget is ready. No path configured and no interactive operation ongoing.
 * - creating: user is creating a new input path.
 * - created: input path is configured but no interactive operation is ongoing.
 * - selecting: user is selecting an existing input path.
 * - selected: user selected an existing input path.
 *
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export type ElevationProfileState = "disabled" | "ready" | "creating" | "created" | "selecting" | "selected";

/**
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export type ElevationProfileLineUnion = ElevationProfileLineGround | ElevationProfileLineInput | ElevationProfileLineQuery | ElevationProfileLineView;

/**
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export interface ElevationQuerySource {
  /**
   * Function used to query elevation values for a geometry ([Point](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Point.html),
   * [Multipoint](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Multipoint.html) or [Polyline](https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polyline.html)).
   * It returns a promise that resolves with an [ElevationQueryResult](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-types.html#ElevationQueryResult).
   *
   * @param geometry - The geometry to use for sampling elevation data.
   * @param options - Additional query options.
   * @returns Resolves to an object with the sampled geometry, resolution information, and no data value.
   * @since 5.0
   */
  queryElevation(geometry: ElevationQueryGeometry, options?: ElevationQueryOptions): Promise<ElevationQueryResult<ElevationQueryGeometry>>;
}

/**
 * A sample/point in a generated elevation profile. The x, y and z properties
 * are in the spatial reference of the view and distance and elevation are in
 * the units specified in the view model.
 *
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export interface ElevationProfileSample {
  /**
   * The x coordinate of the sample, in the spatial reference of the view.
   *
   * @since 5.0
   */
  readonly x: number;
  /**
   * The y coordinate of the sample, in the spatial reference of the view.
   *
   * @since 5.0
   */
  readonly y: number;
  /**
   * The z coordinate of the sample, in the spatial reference of the view.
   *
   * @since 5.0
   */
  readonly z?: number | null;
  /**
   * Horizontal (2D) distance from the beginning of the path, in the
   *    effective unit selected by the user. In geographic coordinate systems (GCS) and in WebMercator,
   *    the distance is the geodesic distance. In projected coordinate systems (PCS), apart from
   *    WebMercator, the distance is computed in a Euclidean manner (in the respective PCS).
   *
   * @since 5.0
   */
  readonly distance: number;
  /**
   * The elevation of the sample, in the effective units selected by the user.
   *
   * @since 5.0
   */
  readonly elevation?: number | null;
}

/**
 * Statistics about a generated elevation profile.
 *
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export interface ElevationProfileStatistics {
  /**
   * The maximum horizontal (2D) distance of the path. In geographic
   * coordinate systems (GCS) and in WebMercator, the distance is the geodesic distance. In projected
   * coordinate systems (PCS), apart from WebMercator, the distance is computed in a Euclidean manner
   * (in the respective PCS).
   *
   * @since 5.0
   */
  readonly maxDistance?: number | null;
  /**
   * The minimum elevation along the path.
   *
   * @since 5.0
   */
  readonly minElevation?: number | null;
  /**
   * The maximum elevation along the path.
   *
   * @since 5.0
   */
  readonly maxElevation?: number | null;
  /**
   * The average elevation along the path.
   *
   * @since 5.0
   */
  readonly avgElevation?: number | null;
  /**
   * The cumulative elevation gain along the path.
   * See https://en.wikipedia.org/wiki/Cumulative_elevation_gain
   *
   * @since 5.0
   */
  readonly elevationGain?: number | null;
  /**
   * The cumulative elevation loss along the path.
   * See https://en.wikipedia.org/wiki/Cumulative_elevation_gain
   *
   * @since 5.0
   */
  readonly elevationLoss?: number | null;
  /**
   * The maximum positive slope along the path. Profiles are sampled at a
   *   minimum distance of 10 meters (32.8 feet). Higher resolution profiles are downsampled to that minimum sampling
   *   distance before calculating the slope.
   *
   * @since 5.0
   */
  readonly maxPositiveSlope?: number | null;
  /**
   * The maximum negative slope along the path. Profiles are sampled at a
   *   minimum distance of 10 meters (32.8 feet). Higher resolution profiles are downsampled to that minimum sampling
   *   distance before calculating the slope.
   *
   * @since 5.0
   */
  readonly maxNegativeSlope?: number | null;
  /**
   * The average positive slope along the path. Profiles are sampled at a
   *   minimum distance of 10 meters (32.8 feet). Higher resolution profiles are downsampled to that minimum sampling
   *   distance before calculating the slope.
   *
   * @since 5.0
   */
  readonly avgPositiveSlope?: number | null;
  /**
   * The average negative slope along the path. Profiles are sampled at a
   *   minimum distance of 10 meters (32.8 feet). Higher resolution profiles are downsampled to that minimum sampling
   *   distance before calculating the slope.
   *
   * @since 5.0
   */
  readonly avgNegativeSlope?: number | null;
}

/**
 * The units which have been selected according to the magnitude of the elevations and distances
 * that are to be displayed in the widget, according to the selected unit or unit system.
 *
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export interface EffectiveUnits {
  /**
   * Units used for displaying distance or length values.
   *
   * @since 5.0
   */
  readonly distance: LengthUnit;
  /**
   * Units used for displaying elevation values.
   *
   * @since 5.0
   */
  readonly elevation: LengthUnit;
}

/**
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export type ElevationProfileLineType = "ground" | "input" | "query" | "view";

/**
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export type InteractionMode = "select" | "sketch";

/**
 * @deprecated since version 5.0. Use the [Elevation Profile component](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-elevation-profile/) or [ElevationProfileLineScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfile-ElevationProfileLineScene.html) from [ElevationProfileAnalysis](https://developers.arcgis.com/javascript/latest/api-reference/esri-analysis-ElevationProfileAnalysis.html) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
 * @since 5.0
 */
export interface InteractionStartOptions {
  /**
   * The mode that the widget will start with.
   * In "sketch" mode the user can draw a new line and in "select" mode the user can click
   * on the view to select an existing line.
   *
   * @default "sketch"
   * @since 5.0
   */
  mode: InteractionMode;
}