import type { PivotIndexColum } from '../visualizations/types';
import { type FieldType } from './field';
import { type ResultRow, type ResultValue } from './results';
import type { GroupByColumn, SortBy, ValuesColumn } from './sqlRunner';
export type PivotConfig = {
    pivotDimensions: string[];
    metricsAsRows: boolean;
    columnOrder?: string[];
    hiddenMetricFieldIds?: string[];
    visibleMetricFieldIds?: string[];
    columnTotals?: boolean;
    rowTotals?: boolean;
};
export type PivotConfiguration = {
    indexColumn: PivotIndexColum | PivotIndexColum[] | undefined;
    valuesColumns: ValuesColumn[];
    groupByColumns: GroupByColumn[] | undefined;
    sortBy: SortBy | undefined;
    /**
     * When true, metrics are displayed as rows instead of columns.
     * This affects column limit calculation - when metrics are rows,
     * we don't need to divide the column limit by the number of metrics.
     * Defaults to false for backward compatibility (SQL runner behavior).
     */
    metricsAsRows?: boolean;
    /**
     * Metrics/table calculations needed for sort anchor CTEs but not for display.
     * These are merged into valuesColumns for SQL generation in PivotQueryBuilder,
     * but excluded from pivotDetails so they don't appear as chart series.
     */
    sortOnlyColumns?: ValuesColumn[];
};
type Field = {
    type: FieldType.METRIC;
    fieldId?: undefined;
} | {
    type: FieldType.DIMENSION;
    fieldId: string;
};
type FieldValue = {
    type: 'value';
    fieldId: string;
    value: ResultValue;
    colSpan: number;
} | {
    type: 'label';
    fieldId: string;
};
type TitleField = null | {
    fieldId: string;
    direction: 'index' | 'header';
};
export type TotalField = null | {
    fieldId?: string;
};
type TotalValue = null | number;
type DataValue = null | ResultValue;
export type PivotColumn = {
    fieldId: string;
    baseId: string | undefined;
    underlyingId: string | undefined;
    columnType: string | undefined;
};
export type PivotData = {
    headerValueTypes: Field[];
    headerValues: FieldValue[][];
    indexValueTypes: Field[];
    indexValues: FieldValue[][];
    dataColumnCount: number;
    dataValues: DataValue[][];
    titleFields: TitleField[][];
    rowTotalFields?: TotalField[][];
    columnTotalFields?: TotalField[][];
    rowTotals?: TotalValue[][];
    columnTotals?: TotalValue[][];
    cellsCount: number;
    rowsCount: number;
    pivotConfig: PivotConfig;
    retrofitData: {
        allCombinedData: ResultRow[];
        pivotColumnInfo: PivotColumn[];
    };
    groupedSubtotals?: Record<string, Record<string, number>[]>;
};
export {};
//# sourceMappingURL=pivot.d.ts.map