import { ErrorCode, type CellValue } from '@bilig/protocol';
import type { WorkbookStore } from '../workbook-store.js';
import type { EngineRuntimeColumnStoreService } from '../engine/services/runtime-column-store-service.js';
import type { RegionGraph } from './region-graph.js';
import type { RegionId } from './region-node-store.js';
export interface AggregateStateEntry {
    readonly regionId: RegionId;
    readonly sheetName: string;
    readonly col: number;
    readonly rowStart: number;
    rowEnd: number;
    columnVersion: number;
    structureVersion: number;
    extremaValid: boolean;
    prefixSums: Float64Array;
    prefixCount: Uint32Array;
    prefixAverageCount: Uint32Array;
    prefixErrorCodes: Uint16Array;
    prefixErrorCounts: Uint32Array;
    prefixMinimums: Float64Array;
    prefixMaximums: Float64Array;
}
export interface AggregateColumnWindowSummary {
    readonly sum: number;
    readonly count: number;
    readonly averageCount: number;
    readonly minimum: number;
    readonly maximum: number;
    readonly errorCount: number;
    readonly errorCode: ErrorCode;
    readonly fullPageHits: number;
    readonly edgeCellScans: number;
}
export interface AggregateStateStore {
    readonly getOrBuildPrefixForRegion: (regionId: RegionId, aggregateKind?: 'sum' | 'average' | 'count' | 'min' | 'max') => AggregateStateEntry;
    readonly summarizeColumnWindow: (request: {
        sheetName: string;
        rowStart: number;
        rowEnd: number;
        col: number;
    }) => AggregateColumnWindowSummary | undefined;
    readonly hasReusableColumnPrefix: (request: {
        sheetName: string;
        rowStart: number;
        rowEnd: number;
        col: number;
    }, aggregateKind?: 'sum' | 'average' | 'count' | 'min' | 'max') => boolean;
    readonly noteLiteralWrite: (request: {
        readonly sheetName: string;
        readonly row: number;
        readonly col: number;
        readonly oldValue: CellValue;
        readonly newValue: CellValue;
    }) => void;
    readonly invalidateColumn: (sheetName: string, col: number) => void;
}
export declare function createAggregateStateStore(args: {
    readonly workbook: Pick<WorkbookStore, 'getSheet'>;
    readonly runtimeColumnStore: EngineRuntimeColumnStoreService;
    readonly regionGraph: Pick<RegionGraph, 'getRegion'>;
}): AggregateStateStore;
