import type Polygon from "../../geometry/Polygon.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { PolygonProperties } from "../../geometry/Polygon.js";

export interface SceneModificationProperties extends Partial<Pick<SceneModification, "type">> {
  /**
   * The geometry representing the location of the modification. Only polygon geometries are currently supported.
   *
   * > [!WARNING]
   * >
   * > **Known Limitations**
   * >
   * > The polygon geometry must be simple.
   * >
   * > Polygon geometries can be inspected and simplified before they are used as modifications. Use the
   * > [simplifyOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOperator/) to make sure that modifications are
   * > applied correctly.
   */
  geometry?: PolygonProperties | null;
}

/**
 * A SceneModification is used to perform a client-side geometric modification. Clip, mask, and replace are supported
 * modification types. A collection of [SceneModifications](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SceneModifications/) can be
 * applied to an
 * [IntegratedMeshLayer.modifications](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMeshLayer/#modifications) or
 * [IntegratedMesh3DTilesLayer.modifications](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMesh3DTilesLayer/#modifications).
 *
 * > [!WARNING]
 * >
 * > Scene modifications need to be projectable to the spatial reference of the layer they modify without using the
 * > client-side projectOperator (see
 * > [supported coordinate systems](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#supported-coordinate-systems)). Reprojection of the
 * > geometry to other spatial references can be done with the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/).
 *
 * @since 4.16
 * @see [Sample - Integrated mesh modification](https://developers.arcgis.com/javascript/latest/sample-code/layers-integratedmeshlayer-modification/)
 * @see [IntegratedMeshLayer.modifications](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMeshLayer/#modifications)
 * @see [IntegratedMesh3DTilesLayer.modifications](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMesh3DTilesLayer/#modifications)
 * @see [SceneModifications](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SceneModifications/)
 */
export default class SceneModification extends JSONSupport {
  constructor(properties?: SceneModificationProperties);
  /**
   * The geometry representing the location of the modification. Only polygon geometries are currently supported.
   *
   * > [!WARNING]
   * >
   * > **Known Limitations**
   * >
   * > The polygon geometry must be simple.
   * >
   * > Polygon geometries can be inspected and simplified before they are used as modifications. Use the
   * > [simplifyOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/simplifyOperator/) to make sure that modifications are
   * > applied correctly.
   */
  get geometry(): Polygon | null | undefined;
  set geometry(value: PolygonProperties | null | undefined);
  /**
   * The type of modification to perform.
   *
   * Illustration | Modification | Description
   * ------|------------|--------
   * <img src="https://developers.arcgis.com/javascript/latest/assets/img/apiref/layers/modification-clip.png" alt="modification-type-clip" style="width:100px;"/>| <b>clip</b> - removes selected area | Clip-out portions of the integrated mesh to see features below. For example, utility work on gas or water lines in an area. Planners can create a scene in which the integrated mesh is clipped out at a site to expose the water or gas lines below it.
   * <img src="https://developers.arcgis.com/javascript/latest/assets/img/apiref/layers/modification-mask.png" alt="modification-type-mask" style="width:100px;"/> | <b>mask</b> - displays only selected area |  Define an area of interest. Use a polygon and draw only parts of the integrated mesh inside that polygon. For example, if you want to show only a portion of an integrated mesh within the boundaries of a city.
   * <img src="https://developers.arcgis.com/javascript/latest/assets/img/apiref/layers/modification-replace.png" alt="modification-type-replace" style="width:100px;"/> | <b>replace</b> - flattens selected area |Replace an area of an integrated mesh based on a 3D polygon. For example, to add constructed buildings, flatten the integrated mesh at the footprint of a building so the new building can be visualized. Create different scenarios of the new construction area and share the scenarios as a web scene to discuss with stakeholders. The integrated mesh flattens to the minimum z-vertex of the modification polygon.
   *
   * @default "clip"
   * @see [IntegratedMeshLayer.modifications](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMeshLayer/#modifications)
   * @see [IntegratedMesh3DTilesLayer.modifications](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMesh3DTilesLayer/#modifications)
   */
  accessor type: "clip" | "mask" | "replace";
  /**
   * Creates a clone of this object.
   *
   * @returns A clone of the [SceneModification](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SceneModification/) instance that
   *   invoked this method.
   */
  clone(): SceneModification;
}