import { Effect } from 'effect';
import { type CellSnapshot, type WorkbookSnapshot } from '@bilig/protocol';
import type { EngineCellMutationRef, EngineFormulaSourceRefs } from '../../cell-mutations-at.js';
import type { HydratedPreparedFormulaInitializationRef, PreparedFormulaInitializationRef } from './formula-initialization-service.js';
import type { FormulaInstanceSnapshot } from '../../formula/formula-instance-table.js';
import type { FormulaTemplateResolution, FormulaTemplateSnapshot } from '../../formula/template-bank.js';
import type { CachedRuntimeFormulaRef } from '../../snapshot/runtime-image-cached-formula-refs.js';
import type { RuntimeImageFormulaFamilyRunSnapshot } from '../../snapshot/runtime-image-formula-family-runs.js';
import type { EngineRuntimeState, EngineReplicaSnapshot } from '../runtime-state.js';
import { EngineSnapshotError } from '../errors.js';
import type { WorkbookPivotRecord } from '../../workbook-store.js';
import type { InitialFormulaEntryRefSource } from './formula-initialization-refs.js';
export interface EngineSnapshotExportOptions {
    readonly includeRuntimeImage?: boolean;
}
export interface EngineSnapshotService {
    readonly exportWorkbook: (options?: EngineSnapshotExportOptions) => Effect.Effect<WorkbookSnapshot, EngineSnapshotError>;
    readonly importWorkbook: (snapshot: WorkbookSnapshot) => Effect.Effect<void, EngineSnapshotError>;
    readonly exportReplica: () => Effect.Effect<EngineReplicaSnapshot, EngineSnapshotError>;
    readonly importReplica: (snapshot: EngineReplicaSnapshot) => Effect.Effect<void, EngineSnapshotError>;
}
export declare function createEngineSnapshotService(args: {
    readonly state: Pick<EngineRuntimeState, 'workbook' | 'strings' | 'formulas' | 'replicaState' | 'entityVersions' | 'sheetDeleteVersions'>;
    readonly getCellByIndex: (cellIndex: number) => CellSnapshot;
    readonly resetWorkbook: (workbookName?: string) => void;
    readonly exportTemplateBank?: () => readonly FormulaTemplateSnapshot[];
    readonly exportFormulaInstances?: () => readonly FormulaInstanceSnapshot[];
    readonly exportFormulaFamilyRuns?: () => readonly RuntimeImageFormulaFamilyRunSnapshot[];
    readonly hydrateTemplateBank?: (templates: readonly FormulaTemplateSnapshot[]) => void;
    readonly resolveTemplateById?: (templateId: number, source: string, row: number, col: number) => FormulaTemplateResolution | undefined;
    readonly beginEvaluationBudget?: (startedAtMs: number) => void;
    readonly endEvaluationBudget?: () => void;
    readonly checkEvaluationBudget?: (stepCost?: number) => void;
    readonly initializeCellFormulasAt: (refs: readonly EngineCellMutationRef[], potentialNewCells?: number) => void;
    readonly initializeFormulaSourcesAt?: (refs: EngineFormulaSourceRefs, potentialNewCells?: number) => void;
    readonly resolveTemplateForCell?: (source: string, row: number, col: number) => FormulaTemplateResolution;
    readonly initializePreparedCellFormulasAt?: (refs: InitialFormulaEntryRefSource<PreparedFormulaInitializationRef>, potentialNewCells?: number) => void;
    readonly initializeHydratedPreparedCellFormulasAt?: (refs: InitialFormulaEntryRefSource<HydratedPreparedFormulaInitializationRef>, potentialNewCells?: number) => void;
    readonly initializeCachedFormulaSourcesAt?: (refs: readonly CachedRuntimeFormulaRef[], potentialNewCells?: number) => void;
    readonly materializePivot?: (pivot: WorkbookPivotRecord) => number[];
    readonly emitFullInvalidation?: (options: {
        readonly incrementMetrics: boolean;
    }) => void;
}): EngineSnapshotService;
