import type Accessor from "../../../core/Accessor.js";
import type BuildingSceneLayer from "../../../layers/BuildingSceneLayer.js";
import type CSVLayer from "../../../layers/CSVLayer.js";
import type FeatureLayer from "../../../layers/FeatureLayer.js";
import type GeoJSONLayer from "../../../layers/GeoJSONLayer.js";
import type GraphicsLayer from "../../../layers/GraphicsLayer.js";
import type Layer from "../../../layers/Layer.js";
import type MapNotesLayer from "../../../layers/MapNotesLayer.js";
import type SceneLayer from "../../../layers/SceneLayer.js";
import type WFSLayer from "../../../layers/WFSLayer.js";
import type Sublayer from "../../../layers/support/Sublayer.js";
import type SubtypeSublayer from "../../../layers/support/SubtypeSublayer.js";

export interface FeatureSnappingLayerSourceProperties<T extends Layer | SubtypeSublayer | Sublayer = BuildingSceneLayer | CSVLayer | FeatureLayer | GeoJSONLayer | GraphicsLayer | MapNotesLayer | SceneLayer | SubtypeSublayer | WFSLayer> extends Partial<Pick<FeatureSnappingLayerSource<T>, "enabled">> {
  /**
   * The source layer used for snapping.
   *
   * @see [SnappingOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html)
   */
  layer?: T;
}

/**
 * The FeatureSnappingLayerSource specifies which layers will be utilized for snapping in the
 * [SnappingOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html).
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > Layer types currently supported for snapping are: [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html),
 * > [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html) (except Mesh geometries), [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html),
 * > [WFSLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WFSLayer.html), [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html),
 * > [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-SubtypeSublayer.html) (2D only), [MapNotesLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapNotesLayer.html) (2D only),
 * > [3D Object SceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html) (3D only), and [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html) (3D only).
 *
 * @since 4.19
 * @see [SnappingOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html)
 * @example
 * // Create a new instance of Sketch, and set
 * // a layer for one of the featureSources property.
 * // This enables feature snapping on that layer.
 * const Sketch = new Sketch({
 *   layer: graphicsLayer,
 *   view: view,
 *   snappingOptions: { // autocasts to SnappingOptions()
 *     enabled: true, // global snapping is turned on
 *     // assigns a collection of FeatureSnappingLayerSource() and enables feature snapping on this layer
 *     featureSources: [{ layer: graphicsLayer, enabled: true }]
 *   }
 * });
 */
export default class FeatureSnappingLayerSource<T extends Layer | SubtypeSublayer | Sublayer = BuildingSceneLayer | CSVLayer | FeatureLayer | GeoJSONLayer | GraphicsLayer | MapNotesLayer | SceneLayer | SubtypeSublayer | WFSLayer> extends Accessor {
  constructor(properties?: FeatureSnappingLayerSourceProperties);
  /**
   * Indicates whether feature snapping is turned on or off.
   *
   * @default true
   */
  accessor enabled: boolean;
  /**
   * The source layer used for snapping.
   *
   * @see [SnappingOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html)
   */
  get layer(): T;
}