import type Error from "../../../../core/Error.js";

/** The volume measurement error name. */
export type VolumeMeasurementErrorName = "insufficient-data" | "perimeter-too-large" | "unsupported-coordinate-system" | "unsupported-layer-transparency" | "unknown";

/**
 * VolumeMeasurementError is an error class for reporting errors in a [VolumeMeasurementAnalysisView3D.result](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/#result).
 *
 * The following error names are defined:
 *
 * - "insufficient-data": Insufficient data for an accurate measurement.
 * - "perimeter-too-large": The input geometry's perimeter is too large for the current coordinate system.
 * - "unsupported-coordinate-system": The coordinate system of the view (viewing mode and spatial reference) is not supported.
 * - "unsupported-layer-transparency": The volume measurement analysis does not support transparent layers.
 * - "unknown": An unknown error occurred.
 *
 * @since 4.34
 * @see [VolumeMeasurementAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/VolumeMeasurementAnalysis/)
 * @see [VolumeMeasurementAnalysisView3D](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/VolumeMeasurementAnalysisView3D/)
 * @see [Sample - Volume measurement analysis object](https://developers.arcgis.com/javascript/latest/sample-code/analysis-volume-measurement/)
 */
export default class VolumeMeasurementError<T = any> extends Error {
  constructor(name: VolumeMeasurementErrorName, message: string, details?: T);
  /**
   * The name of the volume measurement error.
   *
   * @default "unknown"
   * @example
   * someAsyncFunction.then(callback)
   *   .catch(function(error){
   *     console.log("Error name: ", error.name);
   * });
   */
  readonly name: VolumeMeasurementErrorName;
}