/**
 * Types common to the [ElevationProfileAnalysisView2D](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-analysis-ElevationProfileAnalysisView2D.html) and
 * [ElevationProfileAnalysisView3D](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-3d-analysis-ElevationProfileAnalysisView3D.html).
 *
 * @since 5.0
 */
import type Graphic from "../../../Graphic.js";
import type { LengthUnit } from "../../../core/units.js";

export interface ElevationProfileSample {
  /**
   * Horizontal (2D) distance from the beginning of the path, in the
   *    effective units. 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).
   */
  readonly distance: number;
  /** The elevation of the sample, in the effective units selected by the user. */
  readonly elevation?: number | null;
  /** The x coordinate of the sample, in the spatial reference of the view. */
  readonly x: number;
  /** The y coordinate of the sample, in the spatial reference of the view. */
  readonly y: number;
  /** The z coordinate of the sample, in the spatial reference of the view. */
  readonly z?: number | null;
}

export interface ElevationProfileStatistics {
  /** The average elevation along the path. */
  readonly avgElevation?: 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.
   */
  readonly avgNegativeSlope?: 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.
   */
  readonly avgPositiveSlope?: number | null;
  /**
   * The cumulative elevation gain along the path.
   * See https://en.wikipedia.org/wiki/Cumulative_elevation_gain
   */
  readonly elevationGain?: number | null;
  /**
   * The cumulative elevation loss along the path.
   * See https://en.wikipedia.org/wiki/Cumulative_elevation_gain
   */
  readonly elevationLoss?: number | null;
  /**
   * 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).
   */
  readonly maxDistance?: number | null;
  /** The maximum elevation along the path. */
  readonly maxElevation?: 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.
   */
  readonly maxNegativeSlope?: 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.
   */
  readonly maxPositiveSlope?: number | null;
  /** The minimum elevation along the path. */
  readonly minElevation?: number | null;
}

/** Result of interactively placing an elevation profile line on the view. */
export interface ElevationProfilePlacementResult {}

/** Result of picking a feature from the view to perform an elevation profile analysis. */
export interface ElevationProfilePickResult {
  /** The picked feature. */
  feature: Graphic;
}

/**
 * Effective units for the elevation profile analysis, determined based on the magnitues of the values in all the
 * results and the options specified by the user.
 */
export interface ElevationProfileEffectiveDisplayUnits {
  /** The effective distance unit used for the results and statistics of the elevation profile analysis. */
  readonly distance: LengthUnit;
  /** The effective elevation unit used for the results and statistics of the elevation profile analysis. */
  readonly elevation: LengthUnit;
}