import type Collection from "../../core/Collection.js";
import type BuildingFilterBlock from "./BuildingFilterBlock.js";
import type { JSONSupport, JSONSupportMixinProperties } from "../../core/JSONSupport.js";
import type { BuildingFilterBlockProperties } from "./BuildingFilterBlock.js";
import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";

export interface BuildingFilterProperties extends JSONSupportMixinProperties, Partial<Pick<BuildingFilter, "description" | "name">> {
  /**
   * Filter blocks define which features should be visible in the affected [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html)
   * and how the filtered features are drawn. A filter should contain at least one filter block.
   *
   * The order of filter blocks influences the order in which the filter blocks are applied.
   * For example, if a filter block using a `wire-frame` mode precedes a `solid` filter block in the collection, elements that match either filter block will be drawn as wireframe.
   */
  filterBlocks?: ReadonlyArrayOrCollection<BuildingFilterBlockProperties> | null;
  /**
   * Unique filter id.
   * Assign this id to [BuildingSceneLayer#activeFilterId](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html#activeFilterId) to activate the filter.
   */
  id?: string;
}

/**
 * The `BuildingFilter` class defines a set of conditions that can be used to show or hide specific features of
 * a [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html) in the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
 * For example, if you want to see parts of a building that are on the second floor, you can set a filter to only show the second floor.
 * The filter can be activated on a layer by adding it to the [BuildingSceneLayer#filters](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html#filters) collection
 * and assigning [id](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-BuildingFilter.html#id) to [BuildingSceneLayer#activeFilterId](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html#activeFilterId).
 * Once the filter is activated, only the features that satisfy the conditions defined by [filterBlocks](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-BuildingFilter.html#filterBlocks)
 * are displayed in the [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
 *
 * @since 4.12
 * @see [Sample - Filter BuildingScenelayer](https://developers.arcgis.com/javascript/latest/sample-code/building-scene-layer-filter/)
 * @see [BuildingSceneLayer#filters](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html#filters)
 * @example
 * // define a floor filter
 * const buildingFilter = new BuildingFilter({
 *   filterBlocks: [{
 *     // an SQL expression that filters using the BldgLevel field
 *     filterExpression: "BldgLevel = 3",
 *     filterMode: {
 *       type: "wire-frame",
 *       edges: {
 *          type: "solid",
 *          color: [0, 0, 0, 0.8]
 *       }
 *     }
 *   }]
 * });
 * // set the filter in the filters array on the layer
 * buildingLayer.filters = [buildingFilter];
 * // specify which filter is the one that should be applied
 * buildingLayer.activeFilterId = buildingFilter.id;
 */
export default class BuildingFilter extends JSONSupport {
  constructor(properties?: BuildingFilterProperties);
  /** Description of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro. */
  accessor description: string | null | undefined;
  /**
   * Filter blocks define which features should be visible in the affected [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html)
   * and how the filtered features are drawn. A filter should contain at least one filter block.
   *
   * The order of filter blocks influences the order in which the filter blocks are applied.
   * For example, if a filter block using a `wire-frame` mode precedes a `solid` filter block in the collection, elements that match either filter block will be drawn as wireframe.
   */
  get filterBlocks(): Collection<BuildingFilterBlock> | null | undefined;
  set filterBlocks(value: ReadonlyArrayOrCollection<BuildingFilterBlockProperties> | null | undefined);
  /**
   * Unique filter id.
   * Assign this id to [BuildingSceneLayer#activeFilterId](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html#activeFilterId) to activate the filter.
   */
  get id(): string;
  /** Name of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro. */
  accessor name: string | null | undefined;
}