/**
 * Provides utility functions for the [CatalogLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CatalogLayer.html).
 *
 * @since 4.30
 * @see [CatalogLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CatalogLayer.html)
 */
import type CatalogLayer from "../CatalogLayer.js";
import type Layer from "../Layer.js";

/**
 * Utility method to check if the layer is temporarily available in the map and can be removed at any time because it is part of a [CatalogLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CatalogLayer.html).
 *
 * It recursively checks if the [layer's parent](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#parent) is [CatalogLayer#dynamicGroupLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CatalogLayer.html#dynamicGroupLayer).
 *
 * Use this utility to selectively exclude layers from your user experience.
 * For example, to limit the options available for these layers in the [LayerList](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html).
 *
 * @param layer - The layer to test.
 * @returns `true` if the layer or its parent is part of a catalog.
 * @example
 * // Get all layer not part of a catalog.
 * const layers = map.allLayers.filter((layer) => !isLayerFromCatalog(layer))
 */
export function isLayerFromCatalog(layer: Layer): boolean;

/**
 * Utility method to get the parent [CatalogLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CatalogLayer.html) for a given layer in
 * [CatalogDynamicGroupLayer#layers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-catalog-CatalogDynamicGroupLayer.html#layers) collection.
 *
 * @param layer - The layer for which the [CatalogLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CatalogLayer.html) is to be retrieved.
 * @returns The catalog for that layer when it can be found.
 * @example
 * // Highlight the footprint for a layer if it's part of a catalog dynamic grouplayer.
 * function highlightFootprintForLayer(view, layer) {
 *   const catalog = getCatalogLayerForLayer(layer);
 *
 *   if (catalog) {
 *     const footprint = catalog.createFootprintFromLayer(layer);
 *
 *     if (footprint) {
 *       const catalogLayerView = view.allLayerViews.find((layerView) => layerView.layer === catalog);
 *       return catalogLayerView?.footprintLayerView?.highlight(footprint);
 *     }
 *   }
 *
 *   return { remove() {} };
 * }
 */
export function getCatalogLayerForLayer(layer: Layer): CatalogLayer | null | undefined;