/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { TypedEventEmitter } from "@fluid-internal/client-utils";
import type { IConnectionDetails, IDeltaManagerEvents, IDeltaManagerFull, IDeltaQueue, IDeltaSender, ReadOnlyInfo } from "@fluidframework/container-definitions/internal";
import type { IErrorBase } from "@fluidframework/core-interfaces";
import type { IClientDetails } from "@fluidframework/driver-definitions";
import type { IAnyDriverError, IClientConfiguration, IDocumentMessage, ISequencedDocumentMessage, ISignalMessage } from "@fluidframework/driver-definitions/internal";
import type { PendingStateManager } from "./pendingStateManager.js";
/**
 * Interface defining event handlers for the BaseDeltaManagerProxy.
 * These handlers allow customization of behavior for various DeltaManager events.
 */
export interface BaseDeltaManagerProxyEventHandlers {
    /**
     * Event handler triggered when the readonly state changes.
     * @param readonly - Indicates if the connection is readonly.
     * @param readonlyConnectionReason - Optional reason and error details for the readonly state.
     */
    onReadonly: (readonly: boolean, readonlyConnectionReason?: {
        reason: string;
        error?: IErrorBase;
    }) => void;
    /**
     * Event handler triggered before sending a message.
     * @param messageBuffer - The buffer of messages to be sent.
     */
    onPrepareSend: (messageBuffer: unknown[]) => void;
    /**
     * Event handler triggered when an operation is submitted.
     * @param message - The document message being submitted.
     */
    onSubmitOp: (message: IDocumentMessage) => void;
    /**
     * Event handler triggered when an operation is received.
     * @param message - The sequenced document message received.
     * @param processingTime - The time taken to process the message.
     */
    onOp: (message: ISequencedDocumentMessage, processingTime: number) => void;
    /**
     * Event handler triggered when a pong response is received.
     * @param latency - The latency of the pong response.
     */
    onPong: (latency: number) => void;
    /**
     * Event handler triggered when a connection is established.
     * @param details - The connection details.
     * @param opsBehind - Optional number of operations behind the latest state.
     */
    onConnect: (details: IConnectionDetails, opsBehind?: number) => void;
    /**
     * Event handler triggered when a disconnection occurs.
     * @param reason - The reason for the disconnection.
     * @param error - Optional error details for the disconnection.
     */
    onDisconnect: (reason: string, error?: IAnyDriverError) => void;
}
/**
 * Base class for DeltaManager proxy that proxy's access to the real DeltaManager.
 *
 * This class allows us to build proxy functionality without actually having to implement all the methods
 * of the DeltaManager.
 */
export declare class BaseDeltaManagerProxy extends TypedEventEmitter<IDeltaManagerEvents> implements IDeltaManagerFull {
    protected readonly deltaManager: IDeltaManagerFull;
    get IDeltaSender(): IDeltaSender;
    get inbound(): IDeltaQueue<ISequencedDocumentMessage>;
    get outbound(): IDeltaQueue<IDocumentMessage[]>;
    get inboundSignal(): IDeltaQueue<ISignalMessage>;
    get minimumSequenceNumber(): number;
    get lastSequenceNumber(): number;
    get lastMessage(): ISequencedDocumentMessage | undefined;
    get lastKnownSeqNumber(): number;
    get initialSequenceNumber(): number;
    get hasCheckpointSequenceNumber(): boolean;
    get clientDetails(): IClientDetails;
    get version(): string;
    get maxMessageSize(): number;
    get serviceConfiguration(): IClientConfiguration | undefined;
    get active(): boolean;
    get readOnlyInfo(): ReadOnlyInfo;
    private readonly eventHandlers;
    constructor(deltaManager: IDeltaManagerFull, overrides?: Partial<BaseDeltaManagerProxyEventHandlers>);
    dispose(): void;
    submitSignal(content: string, targetClientId?: string): void;
    flush(): void;
}
/**
 * Proxy to the real IDeltaManager for restricting certain access to layers below container runtime in summarizer clients:
 * - Summarizer client should be read-only to layers below the container runtime to restrict local changes.
 * - Summarizer client should not be active to layers below the container runtime to restrict local changes.
 */
export declare class DeltaManagerSummarizerProxy extends BaseDeltaManagerProxy {
    protected readonly deltaManager: IDeltaManagerFull;
    static wrapIfSummarizer(deltaManager: IDeltaManagerFull): IDeltaManagerFull;
    get active(): boolean;
    get readOnlyInfo(): ReadOnlyInfo;
    constructor(deltaManager: IDeltaManagerFull);
}
export declare class DeltaManagerPendingOpsProxy extends BaseDeltaManagerProxy {
    protected readonly deltaManager: IDeltaManagerFull;
    private readonly pendingStateManager;
    get minimumSequenceNumber(): number;
    get lastMessage(): ISequencedDocumentMessage | undefined;
    constructor(deltaManager: IDeltaManagerFull, pendingStateManager: Pick<PendingStateManager, "minimumPendingMessageSequenceNumber">);
}
//# sourceMappingURL=deltaManagerProxies.d.ts.map