import { PivotConfig, PivotResult, PivotRow, PivotValueField } from './types';
export type PivotDataRow = Record<string, unknown>;
/**
 * Build a hierarchical pivot result from flat data.
 * Supports multiple row group fields for nested hierarchy.
 */
export declare function buildPivot(rows: PivotDataRow[], config: PivotConfig): PivotResult;
/**
 * Get unique column key combinations from the data.
 */
export declare function getUniqueColumnKeys(rows: PivotDataRow[], columnFields: string[]): string[];
/**
 * Group rows by a single field.
 */
export declare function groupByField(rows: PivotDataRow[], field: string): Map<string, PivotDataRow[]>;
/**
 * Group rows by multiple fields (legacy flat grouping).
 */
export declare function groupByFields(rows: PivotDataRow[], fields: string[]): Map<string, PivotDataRow[]>;
/**
 * Build hierarchical pivot rows recursively.
 * Each level of rowGroupFields creates a new depth level.
 */
export declare function buildHierarchicalPivotRows(rows: PivotDataRow[], rowGroupFields: string[], columnFields: string[], columnKeys: string[], valueFields: PivotValueField[], depth: number, parentKey: string): PivotRow[];
/**
 * Aggregate values for a set of rows across all column keys.
 */
export declare function aggregateValues(rows: PivotDataRow[], columnFields: string[], columnKeys: string[], valueFields: PivotValueField[]): Record<string, number | null>;
/**
 * Calculate the total for a row's values.
 */
export declare function calculateRowTotal(values: Record<string, number | null>): number;
/**
 * Legacy flat pivot row building (for backwards compatibility).
 */
export declare function buildPivotRows(groupedData: Map<string, PivotDataRow[]>, columnFields: string[], columnKeys: string[], valueFields: PivotValueField[], depth: number): PivotRow[];
/**
 * Calculate grand totals across all pivot rows.
 */
export declare function calculateTotals(pivotRows: PivotRow[], columnKeys: string[], valueFields: PivotValueField[]): Record<string, number>;
/**
 * Flatten hierarchical pivot rows for rendering.
 * Respects expanded state - only includes children of expanded groups.
 */
export declare function flattenPivotRows(rows: PivotRow[], expandedKeys?: Set<string>, defaultExpanded?: boolean): PivotRow[];
/**
 * Get all group keys from pivot rows (for expand all / collapse all).
 */
export declare function getAllGroupKeys(rows: PivotRow[]): string[];
//# sourceMappingURL=pivot-engine.d.ts.map