import { Barrier, Disposable } from '@opensumi/ide-core-common';
import { TestItemExpandState, TestsDiff, TestsDiffOp } from '@opensumi/ide-testing/lib/common/testCollection';
import { TestId } from '@opensumi/ide-testing/lib/common/testId';
import * as Convert from '../converter';
import { TestItemImpl, TestItemRootImpl } from './testApi';
type TestItemRaw = Convert.TestItem.Raw;
/**
 * @private
 */
export interface OwnedCollectionTestItem {
    readonly fullId: TestId;
    readonly parent: TestId | null;
    actual: TestItemImpl;
    expand: TestItemExpandState;
    /**
     * Number of levels of items below this one that are expanded. May be infinite.
     */
    expandLevels?: number;
    resolveBarrier?: Barrier;
}
/**
 * Maintains tests created and registered for a single set of hierarchies
 * for a workspace or document.
 * @private
 */
export declare class SingleUseTestCollection extends Disposable {
    private readonly controllerId;
    private readonly debounceSendDiff;
    private readonly diffOpEmitter;
    private _resolveHandler?;
    readonly root: TestItemRootImpl;
    readonly tree: Map<string, OwnedCollectionTestItem>;
    private readonly tags;
    private readonly debug;
    protected diff: TestsDiff;
    constructor(controllerId: string);
    /**
     * Handler used for expanding test items.
     */
    set resolveHandler(handler: undefined | ((item: TestItemRaw | undefined) => void));
    /**
     * Fires when an operation happens that should result in a diff.
     */
    readonly onDidGenerateDiff: import("@opensumi/ide-core-common").Event<TestsDiff>;
    /**
     * Gets a diff of all changes that have been made, and clears the diff queue.
     */
    collectDiff(): TestsDiff;
    /**
     * Pushes a new diff entry onto the collected diff list.
     */
    pushDiff(diff: TestsDiffOp): void;
    /**
     * Expands the test and the given number of `levels` of children. If levels
     * is < 0, then all children will be expanded. If it's 0, then only this
     * item will be expanded.
     */
    expand(testId: string, levels: number): Promise<void> | void;
    dispose(): void;
    private onTestItemEvent;
    private upsertItem;
    private diffTagRefs;
    private incrementTagRefs;
    private decrementTagRefs;
    private setItemParent;
    private connectItem;
    private connectItemAndChildren;
    /**
     * Updates the `expand` state of the item. Should be called whenever the
     * resolved state of the item changes. Can automatically expand the item
     * if requested by a consumer.
     */
    private updateExpandability;
    /**
     * Expands all children of the item, 'levels' deep. If levels is 0, only
     * the children will be expanded. If it's 1, the children and their children
     * will be expanded. If it's <0, it's a no-op.
     */
    private expandChildren;
    /**
     * Calls `discoverChildren` on the item, refreshing all its tests.
     */
    private resolveChildren;
    private pushExpandStateUpdate;
    private removeItem;
    /**
     * Immediately emits any pending diffs on the collection.
     */
    flushDiff(): void;
}
export {};
//# sourceMappingURL=testCollection.d.ts.map