/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { ISummaryTree } from "@fluidframework/driver-definitions";
import { ITree, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
import { AttributionKey } from "@fluidframework/runtime-definitions/internal";
import { MockStorage } from "@fluidframework/test-runtime-utils/internal";
import { Client } from "../client.js";
import { DoublyLinkedList } from "../collections/index.js";
import { IMergeTreeOptions, ReferencePosition } from "../index.js";
import { MergeTree } from "../mergeTree.js";
import { ISegmentPrivate, type SegmentGroup } from "../mergeTreeNodes.js";
import { IJSONSegment, IMarkerDef, IMergeTreeOp, ReferenceType, type IMergeTreeInsertMsg } from "../ops.js";
import { PropertySet } from "../properties.js";
import { MergeTreeRevertibleDriver } from "../revertibles.js";
import { TestSerializer } from "./testSerializer.js";
export declare function specToSegment(spec: IJSONSegment): ISegmentPrivate;
export declare class TestClient extends Client {
    static searchChunkSize: number;
    static readonly serializer: TestSerializer;
    measureOps: boolean;
    accumTime: number;
    accumWindowTime: number;
    accumWindow: number;
    accumOps: number;
    maxWindowTime: number;
    /**
     * Used for in-memory testing.  This will queue a reference string for each client message.
     */
    static useCheckQ: boolean;
    static createFromClientSnapshot(client1: TestClient, newLongClientId: string): Promise<TestClient>;
    static createFromSnapshot(snapshotTree: ITree, newLongClientId: string, specToSeg: (spec: IJSONSegment) => ISegmentPrivate, options?: PropertySet): Promise<TestClient>;
    static createFromSummary(summaryTree: ISummaryTree, newLongClientId: string, specToSeg: (spec: IJSONSegment) => ISegmentPrivate, options?: PropertySet): Promise<TestClient>;
    static createFromStorage(storage: MockStorage, newLongClientId: string, specToSeg: (spec: IJSONSegment) => ISegmentPrivate, options?: PropertySet): Promise<TestClient>;
    readonly mergeTree: MergeTree;
    readonly checkQ: DoublyLinkedList<string>;
    protected readonly q: DoublyLinkedList<ISequencedDocumentMessage>;
    private readonly textHelper;
    constructor(options?: IMergeTreeOptions & PropertySet, specToSeg?: typeof specToSegment, getMinInFlightRefSeq?: () => number | undefined);
    getText(start?: number, end?: number): string;
    enqueueTestString(): void;
    getMessageCount(): number;
    enqueueMsg(msg: ISequencedDocumentMessage): void;
    dequeueMsg(): ISequencedDocumentMessage | undefined;
    applyMessages(msgCount: number): boolean;
    insertTextLocal(pos: number, text: string, props?: PropertySet): IMergeTreeInsertMsg | undefined;
    insertTextRemote(pos: number, text: string, props: PropertySet | undefined, seq: number, refSeq: number, longClientId: string): void;
    removeRangeRemote(start: number, end: number, seq: number, refSeq: number, longClientId: string): void;
    obliterateRangeRemote(start: number, end: number, seq: number, refSeq: number, longClientId: string): void;
    annotateRangeRemote(start: number, end: number, props: PropertySet, seq: number, refSeq: number, longClientId: string): void;
    insertMarkerLocal(pos: number, behaviors: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg | undefined;
    insertMarkerRemote(pos: number, markerDef: IMarkerDef, props: PropertySet, seq: number, refSeq: number, longClientId: string): void;
    relText(clientId: number, refSeq: number): string;
    makeOpMessage(op: IMergeTreeOp | undefined, seq?: number, refSeq?: number, longClientId?: string, minSeqNumber?: number): ISequencedDocumentMessage;
    validate(): void;
    searchFromPos(pos: number, target: RegExp): {
        text: string;
        pos: number;
    } | undefined;
    findRandomWord(): {
        text: string;
        pos: number;
    } | undefined;
    debugDumpTree(tree: MergeTree): string[];
    /**
     * Rebases a (local) position from the perspective `{ seq: seqNumberFrom, localSeq }` to the perspective
     * of the current sequence number. This is desirable when rebasing operations for reconnection. Perform
     * slow-path computations in this function without leveraging the merge-tree's structure
     */
    rebasePosition(pos: number, seqNumberFrom: number, localSeq: number): number;
    findReconnectionPosition(segment: ISegmentPrivate, localSeq: number): number;
    /**
     * Validates segments either all have attribution information or none of them.
     * If no segment has attribution information, returns undefined.
     *
     * @param channel - Attribution channel name to request information from.
     * @returns an array of all attribution seq#s from the current perspective.
     * The `i`th entry of the array is the attribution key for the character at position `i`.
     */
    getAllAttributionSeqs(channel?: string): (number | AttributionKey | undefined)[];
    peekPendingSegmentGroups(): SegmentGroup | undefined;
    peekPendingSegmentGroups(count: number): SegmentGroup | SegmentGroup[] | undefined;
    /**
     * Override and add some test only metrics
     */
    applyMsg(msg: ISequencedDocumentMessage, local?: boolean): void;
    /**
     * Override and add some test only metrics
     */
    updateMinSeq(minSeq: number): void;
    slowSearchForMarker(startPos: number, markerLabel: string, forwards?: boolean): ReferencePosition | undefined;
}
export type TestClientRevertibleDriver = MergeTreeRevertibleDriver & Partial<{
    submitOpCallback?: (op: IMergeTreeOp | undefined) => void;
}>;
export declare const createRevertDriver: (client: TestClient) => TestClientRevertibleDriver;
export interface MergeTreeStats {
    maxHeight: number;
    nodeCount: number;
    leafCount: number;
    removedLeafCount: number;
    liveCount: number;
    histo: number[];
    windowTime?: number;
    packTime?: number;
    ordTime?: number;
    maxOrdTime?: number;
}
export declare function getStats(tree: MergeTree): MergeTreeStats;
//# sourceMappingURL=testClient.d.ts.map