import type PointCloudFilter from "./PointCloudFilter.js";
import type { PointCloudFilterProperties } from "./PointCloudFilter.js";

export interface PointCloudValueFilterProperties extends PointCloudFilterProperties, Partial<Pick<PointCloudValueFilter, "mode" | "values">> {}

/**
 * Every lidar point can have a classification that defines the type of surface that reflected
 * the laser pulse. The different categories (for example building, high vegetation, ground) are defined
 * using numeric integer codes in the LAS files.
 * The full list of categories including the corresponding codes can be found in the LAS specification.
 *
 * PointCloudValueFilter is used to filter points based on the category that they belong to.
 * For example, to display only points that belong to vegetation, the following filter can be set on the
 * layer:
 *
 * ```js
 * const pcLayer = new PointCloudLayer({
 *   url: "https://tiles.arcgis.com/tiles/z2tnIkrLQ2BRzr6P/arcgis/rest/services/SONOMA_AREA1_LiDAR_RGB/SceneServer",
 *   filters: [{
 *     type: "value",
 *     field: "CLASS_CODE",
 *     mode: "include",
 *     // values includes high vegetation(5)
 *     values: [5]
 *   }]
 * });
 * ```
 *
 * [![pcl-value-filter](https://developers.arcgis.com/javascript/latest/assets/references/core/layers/pcl-value-filter.avif)](https://developers.arcgis.com/javascript/latest/sample-code/layers-pointcloud-filters/)
 *
 * @since 4.10
 * @see [Sample - Filter points in a PointCloudLayer](https://developers.arcgis.com/javascript/latest/sample-code/layers-pointcloud-filters/)
 */
export default class PointCloudValueFilter extends PointCloudFilter {
  constructor(properties?: PointCloudValueFilterProperties);
  /**
   * Whether points should be included or excluded from the filter.
   *
   * @default "exclude"
   */
  accessor mode: PointCloudValueFilterMode;
  /** The type of filter. */
  get type(): "value";
  /**
   * An array of numeric values representing the classification codes
   * that the filter should apply.
   */
  accessor values: number[];
}

export type PointCloudValueFilterMode = "exclude" | "include";