/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { TypedEventEmitter } from "@fluid-internal/client-utils";
import { IFluidHandleContext } from "@fluidframework/core-interfaces/internal";
import { IFluidErrorBase, ITelemetryLoggerExt, LoggingError } from "@fluidframework/telemetry-utils/internal";
import { ISummaryConfiguration } from "../containerRuntime.js";
import { ICancellableSummarizerController } from "./runWhileConnectedCoordinator.js";
import { EnqueueSummarizeResult, IConnectableRuntime, IEnqueueSummarizeOptions, IOnDemandSummarizeOptions, ISummarizeResults, ISummarizer, ISummarizerEvents, ISummarizerInternalsProvider, ISummarizerRuntime, ISummarizingWarning, SummarizerStopReason } from "./summarizerTypes.js";
import { SummaryCollection } from "./summaryCollection.js";
export declare class SummarizingWarning extends LoggingError implements ISummarizingWarning, IFluidErrorBase {
    readonly logged: boolean;
    readonly errorType = "summarizingError";
    readonly canRetry = true;
    constructor(errorMessage: string, logged?: boolean);
    static wrap(error: any, logged: boolean | undefined, logger: ITelemetryLoggerExt): SummarizingWarning;
}
export declare const createSummarizingWarning: (errorMessage: string, logged: boolean) => SummarizingWarning;
/**
 * Summarizer is responsible for coordinating when to generate and send summaries.
 * It is the main entry point for summary work.
 * It is created only by summarizing container (i.e. one with clientType === "summarizer")
 * @alpha
 */
export declare class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {
    /** Reference to runtime that created this object.
     * i.e. runtime with clientType === "summarizer"
     */
    private readonly runtime;
    private readonly configurationGetter;
    /** Represents an object that can generate summary.
     * In practical terms, it's same runtime (this.runtime) with clientType === "summarizer".
     */
    private readonly internalsProvider;
    readonly summaryCollection: SummaryCollection;
    private readonly runCoordinatorCreateFn;
    get ISummarizer(): this;
    private readonly logger;
    private runningSummarizer?;
    private _disposed;
    private starting;
    private readonly stopDeferred;
    constructor(
    /** Reference to runtime that created this object.
     * i.e. runtime with clientType === "summarizer"
     */
    runtime: ISummarizerRuntime, configurationGetter: () => ISummaryConfiguration, 
    /** Represents an object that can generate summary.
     * In practical terms, it's same runtime (this.runtime) with clientType === "summarizer".
     */
    internalsProvider: ISummarizerInternalsProvider, handleContext: IFluidHandleContext, summaryCollection: SummaryCollection, runCoordinatorCreateFn: (runtime: IConnectableRuntime) => Promise<ICancellableSummarizerController>);
    run(onBehalfOf: string): Promise<SummarizerStopReason>;
    /**
     * Stops the summarizer from running.  This will complete
     * the run promise, and also close the container.
     * @param reason - reason code for stopping
     */
    stop(reason: SummarizerStopReason): void;
    close(): void;
    private runCore;
    /**
     * Should we try to run a last summary for the given stop reason?
     * Currently only allows "parentNotConnected"
     * @param stopReason - SummarizerStopReason
     * @returns `true` if the stop reason can run a last summary, otherwise `false`.
     */
    static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean;
    private _heuristicData;
    /**
     * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.
     * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user
     * (in the on-demand case).
     * @param onBehalfOf - ID of the client that requested that the summarizer start
     * @param runCoordinator - cancellation token
     * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.
     * @returns A promise that is fulfilled when the RunningSummarizer is ready.
     */
    private start;
    private readonly handleSummarizeEvent;
    /**
     * Disposes of resources after running.  This cleanup will
     * clear any outstanding timers and reset some of the state
     * properties.
     * Called by ContainerRuntime when it is disposed, as well as at the end the run().
     */
    dispose(): void;
    summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;
    enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;
    recordSummaryAttempt?(summaryRefSeqNum?: number): void;
}
//# sourceMappingURL=summarizer.d.ts.map