import type Multipoint from "../../geometry/Multipoint.js";
import type Point from "../../geometry/Point.js";
import type Polyline from "../../geometry/Polyline.js";
import type { GroundElevationLayer } from "./layerUtils.js";

/** Supported geometries to query elevation for. */
export type QueryGeometry = Point | Multipoint | Polyline;

/** Object returned when [ElevationLayer#queryElevation()](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ElevationLayer.html#queryElevation), [Ground#queryElevation()](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html#queryElevation), or [Ground#queryElevation()](https://developers.arcgis.com/javascript/latest/api-reference/esri-Ground.html#queryElevation) promise resolves: */
export interface ElevationQueryResult<GeometryType> {
  /** The geometry with sampled z-values. */
  geometry: GeometryType;
  /** The value used when there is no data available. */
  noDataValue?: number | null;
  /**
   * Contains additional information about how the geometry was sampled.
   *                                   This property is present depending on whether the user set `options.returnSampleInfo = true`,
   *                                   for each coordinate in the geometry.
   */
  sampleInfo?: SampleInfo[];
}

export interface SampleInfo {
  /**
   * The resolution at which the z-value was sampled.
   *                                   If no data was available for sampling for a given coordinate,
   *                                   the dem resolution value will be -1 for that coordinate.
   */
  demResolution: number;
  /**
   * The elevation source from which
   *                                   the data for the corresponding coordinate was sampled.
   */
  source?: GroundElevationLayer;
}