/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { TSchema, Static } from "@sinclair/typebox";
import { SessionId } from "@fluidframework/id-compressor";
import { Brand } from "../util/index.js";
import { RevisionTag, EncodedRevisionTag } from "../core/index.js";
/**
 * Contains a single change to the `SharedTree` and associated metadata.
 *
 * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.
 * If this is an encoded format, clarify the difference between it and EncodedCommit.
 */
export interface Commit<TChangeset> {
    readonly revision: RevisionTag;
    readonly change: TChangeset;
    /** An identifier representing the session/user/client that made this commit */
    readonly sessionId: SessionId;
}
export type EncodedCommit<TChangeset> = {
    readonly revision: EncodedRevisionTag;
    readonly change: TChangeset;
    readonly sessionId: SessionId;
};
export type SeqNumber = Brand<number, "edit-manager.SeqNumber">;
declare const SequenceId: import("@sinclair/typebox").TObject<{
    sequenceNumber: import("@sinclair/typebox").TUnsafe<SeqNumber>;
    indexInBatch: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
}>;
export type SequenceId = Static<typeof SequenceId>;
/**
 * A commit with a sequence number but no parentage; used for serializing the `EditManager` into a summary
 */
export interface SequencedCommit<TChangeset> extends Commit<TChangeset>, SequenceId {
}
/**
 * A branch off of the trunk for use in summaries.
 *
 * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.
 * If this is an encoded format, use EncodedCommit instead of Commit or clarify that Commit is also an encoded format.
 */
export interface SummarySessionBranch<TChangeset> {
    readonly base: RevisionTag;
    readonly commits: Commit<TChangeset>[];
}
export interface EncodedSummarySessionBranch<TChangeset> {
    readonly base: EncodedRevisionTag;
    readonly commits: Commit<TChangeset>[];
}
export interface EncodedEditManager<TChangeset> {
    readonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];
    readonly branches: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];
    readonly version: typeof version;
}
export declare const version = 1;
export declare const EncodedEditManager: <ChangeSchema extends TSchema>(tChange: ChangeSchema) => import("@sinclair/typebox").TObject<{
    version: import("@sinclair/typebox").TLiteral<1>;
    trunk: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<import("@sinclair/typebox").TCompositeReduce<[import("@sinclair/typebox").TObject<{
        revision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>;
        change: ChangeSchema;
        sessionId: import("@sinclair/typebox").TUnsafe<SessionId>;
    }>, import("@sinclair/typebox").TObject<{
        sequenceNumber: import("@sinclair/typebox").TUnsafe<SeqNumber>;
        indexInBatch: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
    }>]>>>;
    branches: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnsafe<SessionId>, import("@sinclair/typebox").TObject<{
        base: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>;
        commits: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<import("@sinclair/typebox").TCompositeReduce<[import("@sinclair/typebox").TObject<{
            revision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>;
            change: ChangeSchema;
            sessionId: import("@sinclair/typebox").TUnsafe<SessionId>;
        }>]>>>;
    }>]>>;
}>;
export {};
//# sourceMappingURL=editManagerFormat.d.ts.map