import { IDisposable } from '@opensumi/ide-utils';
import { ICompositeTreeNode, ITreeNode, ITreeNodeOrCompositeTreeNode } from './tree-node';
export declare enum TreeNodeEvent {
    WillChangeExpansionState = 1,
    DidChangeExpansionState = 2,
    WillChangeParent = 3,
    DidChangeParent = 4,
    DidDispose = 5,
    BranchDidUpdate = 6,
    DidChangePath = 7,
    DidProcessWatchEvent = 8,
    WillProcessWatchEvent = 9,
    DidChangeMetadata = 10,
    DidResolveChildren = 11,
    WillResolveChildren = 12
}
export declare enum WatchEvent {
    /**
     * 节点添加事件
     */
    Added = 1,
    /**
     * 节点移除事件
     */
    Removed = 2,
    /**
     * 避免过多的调用该事件
     * 该事件会执行较大成本的节点刷新
     */
    Changed = 3,
    /**
     * 节点移动事件
     */
    Moved = 4
}
export interface IWatcherChangeEvent {
    type: WatchEvent.Changed;
    /**
     * 改变的节点路径
     */
    path: string;
}
export interface IWatcherAddEvent {
    type: WatchEvent.Added;
    /**
     * 改变的节点ID，这里一般为父节点ID
     */
    id: number;
    /**
     * 添加的节点
     */
    node: ITreeNode;
}
export interface IWatcherRemoveEvent {
    type: WatchEvent.Removed;
    /**
     * 移除的节点路径
     */
    path: string;
}
export interface IWatcherMoveEvent {
    type: WatchEvent.Moved;
    /**
     * 旧父节点路径
     */
    oldPath: string;
    /**
     * 新父节点路径
     */
    newPath: string;
}
export declare enum MetadataChangeType {
    Added = 1,
    Updated = 2,
    Removed = 3
}
export interface IMetadataChange {
    type: MetadataChangeType;
    key: string;
    prevValue: any;
    value: any;
}
export interface IWatcherInfo {
    terminator: IWatchTerminator;
    callback: IWatcherCallback;
}
export type IWatchTerminator = (path?: string) => void;
export type IWatcherCallback = (event: IWatcherEvent) => void;
export type IWatcherEvent = IWatcherChangeEvent | IWatcherAddEvent | IWatcherRemoveEvent | IWatcherMoveEvent;
/**
 * 每个根节点都包含一个在根节点创建同时传入的`TreeSupervisor`
 *
 * 其存在是为了便于事件委派发生在树中某处以及其他共享内容（在树中共享，但对于每个“根”都是唯一的）事件
 */
export interface ITreeWatcher {
    onWatchEvent(path: string, callback: IWatcherCallback): IWatchTerminator;
    on(event: TreeNodeEvent, callback: any): IDisposable;
    notifyWillChangeParent(target: ITreeNodeOrCompositeTreeNode, prevParent: ICompositeTreeNode, newParent: ICompositeTreeNode): any;
    notifyDidChangeParent(target: ITreeNodeOrCompositeTreeNode, prevParent: ICompositeTreeNode, newParent: ICompositeTreeNode): any;
    notifyDidDispose(target: ITreeNodeOrCompositeTreeNode): any;
    notifyWillProcessWatchEvent(target: ICompositeTreeNode, event: IWatcherEvent): any;
    notifyDidProcessWatchEvent(target: ICompositeTreeNode, event: IWatcherEvent): any;
    notifyWillChangeExpansionState(target: ICompositeTreeNode, nowExpanded: boolean): any;
    notifyDidChangeExpansionState(target: ICompositeTreeNode, nowExpanded: boolean): any;
    notifyWillResolveChildren(target: ICompositeTreeNode, nowExpanded: boolean): any;
    notifyDidResolveChildren(target: ICompositeTreeNode, nowExpanded: boolean): any;
    notifyDidChangePath(target: ITreeNodeOrCompositeTreeNode): any;
    notifyDidChangeMetadata(target: ITreeNodeOrCompositeTreeNode, change: IMetadataChange): any;
    notifyDidUpdateBranch(): any;
    dispose: IDisposable;
}
//# sourceMappingURL=watcher.d.ts.map