import { OmitOverUnion } from "@itwin/presentation-shared";
import { HierarchyFilteringPath, HierarchyFilteringPathOptions } from "./HierarchyFiltering.js";
import { ClassGroupingNodeKey, GenericNodeKey, GroupingNodeKey, HierarchyNodeKey, IModelHierarchyNodeKey, IModelInstanceKey, InstancesNodeKey, LabelGroupingNodeKey, PropertyGroupingNodeKey, PropertyOtherValuesGroupingNodeKey, PropertyValueGroupingNodeKey, PropertyValueRangeGroupingNodeKey } from "./HierarchyNodeKey.js";
/** @public */
export type HierarchyNodeFilteringProps = {
    /** If set to true, then one of the ancestor nodes in the hierarchy is the filter target. */
    hasFilterTargetAncestor?: boolean;
    /** Paths to node's children that are filter targets. */
    filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];
} & ({
    /** Whether or not this node is a filter target. */
    isFilterTarget?: false;
} | {
    /** Whether or not this node is a filter target. */
    isFilterTarget: true;
    /** Options that were used to filter the node. */
    filterTargetOptions?: HierarchyFilteringPathOptions;
});
/** @public */
export declare namespace HierarchyNodeFilteringProps {
    /** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */
    function create(props: {
        hasFilterTargetAncestor?: boolean;
        filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];
        isFilterTarget?: boolean;
        filterTargetOptions?: HierarchyFilteringPathOptions;
    }): HierarchyNodeFilteringProps | undefined;
}
/**
 * A data structure that defines attributes that are common to all types of hierarchy nodes.
 * @public
 */
interface BaseHierarchyNode {
    /** Identifiers of all node ancestors. Can be used to identify a node in the hierarchy. */
    parentKeys: HierarchyNodeKey[];
    /** Node's display label. */
    label: string;
    /** A flag indicating whether the node has children or not. */
    children: boolean;
    /** A flag indicating whether this node should be auto-expanded in the UI. */
    autoExpand?: boolean;
    /** Additional data that may be assigned to this node. */
    extendedData?: {
        [key: string]: any;
    };
    /** Data that may be assigned to the node if filtering is enabled */
    filtering?: HierarchyNodeFilteringProps;
}
/**
 * A data structure that represents a single non-grouping hierarchy node.
 * @public
 */
export interface NonGroupingHierarchyNode extends BaseHierarchyNode {
    /** An identifier to identify the node in its hierarchy level. */
    key: GenericNodeKey | InstancesNodeKey;
    /**
     * Identifies whether the hierarchy level below this node supports filtering. If not, supplying an instance
     * filter when requesting child hierarchy level will have no effect.
     */
    supportsFiltering?: boolean;
}
/**
 * A data structure that represents a grouping node that groups other nodes.
 * @public
 */
export interface GroupingHierarchyNode extends BaseHierarchyNode {
    /** An identifier to identify this grouping node in its hierarchy level. */
    key: GroupingNodeKey;
    /**
     * Keys of all instances grouped by this node, including deeply nested under
     * other grouping nodes.
     */
    groupedInstanceKeys: IModelInstanceKey[];
    /** The closest ancestor node that is not a grouping node. May be `undefined` if the grouping node grouped root level nodes. */
    nonGroupingAncestor?: ParentHierarchyNode<NonGroupingHierarchyNode>;
}
/**
 * A data structure that represents a single hierarchy node.
 * @public
 */
export type HierarchyNode = NonGroupingHierarchyNode | GroupingHierarchyNode;
/** @public */
export declare namespace HierarchyNode {
    /** Checks whether the given node is a generic node */
    function isGeneric<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & NonGroupingHierarchyNode & {
        key: GenericNodeKey;
    };
    /** Checks whether the given node is a standard (iModel content based) node */
    function isIModelNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & {
        key: IModelHierarchyNodeKey;
    };
    /** Checks whether the given node is an ECInstances-based node */
    function isInstancesNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & NonGroupingHierarchyNode & {
        key: InstancesNodeKey;
    };
    /** Checks whether the given node is a grouping node */
    function isGroupingNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & GroupingHierarchyNode;
    /** Checks whether the given node is a class grouping node */
    function isClassGroupingNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & {
        key: ClassGroupingNodeKey;
        supportsFiltering?: undefined;
    } & GroupingHierarchyNode;
    /** Checks whether the given node is a label grouping node */
    function isLabelGroupingNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & {
        key: LabelGroupingNodeKey;
        supportsFiltering?: undefined;
    } & GroupingHierarchyNode;
    /** Checks whether the given node is property grouping node for other values  */
    function isPropertyOtherValuesGroupingNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & {
        key: PropertyOtherValuesGroupingNodeKey;
        supportsFiltering?: undefined;
    } & GroupingHierarchyNode;
    /** Checks whether the given node is a property value grouping node */
    function isPropertyValueGroupingNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & {
        key: PropertyValueGroupingNodeKey;
        supportsFiltering?: undefined;
    } & GroupingHierarchyNode;
    /** Checks whether the given node is a property value range grouping node */
    function isPropertyValueRangeGroupingNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & {
        key: PropertyValueRangeGroupingNodeKey;
        supportsFiltering?: undefined;
    } & GroupingHierarchyNode;
    /** Checks whether the given node is a property grouping node */
    function isPropertyGroupingNode<TNode extends {
        key: HierarchyNodeKey;
    }>(node: TNode): node is TNode & {
        key: PropertyGroupingNodeKey;
        supportsFiltering?: undefined;
    } & GroupingHierarchyNode;
}
/**
 * A type of `HierarchyNode` that doesn't know about its children and is an input when requesting
 * them using `HierarchyProvider.getNodes`.
 * @public
 */
export type ParentHierarchyNode<TBase = HierarchyNode> = OmitOverUnion<TBase, "children">;
export {};
//# sourceMappingURL=HierarchyNode.d.ts.map