import { type DefaultLabelFormatterCallbackParams, type LineSeriesOption, type TooltipComponentFormatterCallback } from 'echarts';
import { type ItemsMap } from '../../types/field';
import { type ParametersValuesMap } from '../../types/parameters';
import { type ResultRow } from '../../types/results';
import { type PivotReference, type TooltipSortBy } from '../../types/savedCharts';
import { type EChartsSeries, type PivotValuesColumn } from '../types';
/**
 * Translates user pivot refs (metric.dimension.value) to SQL pivot column names.
 * e.g., "orders_unique_order_count.orders_status.completed" -> "orders_unique_order_count_any_completed"
 *
 * User ref format: metric.dim1.val1 or metric.dim1.val1.dim2.val2...
 * Parts length must be odd (metric + pairs of dimension.value)
 */
export declare function translatePivotRef(userRef: string, pivotValuesColumnsMap: Record<string, PivotValuesColumn> | undefined): string | undefined;
/**
 * Find the pivot column name for a simple metric reference by looking through series' pivotReference.
 * This allows users to write `${metric_name}` instead of the full `${metric_name.pivot_dim.pivot_value}` format.
 *
 * Supports two pivot modes:
 * 1. SQL pivot (pivotValuesColumnsMap exists): Look up column in pivotValuesColumnsMap
 * 2. Legacy pivot (pivotValuesColumnsMap undefined): Use hashFieldReference(pivotReference) directly
 *
 * @param ref - The simple metric field reference (e.g., "orders_amount_running_total")
 * @param params - The tooltip params array containing series information
 * @param series - The ECharts series array with pivotReference metadata
 * @param pivotValuesColumnsMap - Map of pivot column names to their metadata (optional, for SQL pivot)
 * @returns The pivot column name if found, undefined otherwise
 */
export declare const findPivotColumnFromSeriesRef: (ref: string, params: Pick<TooltipFormatterParams, "seriesIndex">[], series: EChartsSeries[] | undefined, pivotValuesColumnsMap: Record<string, PivotValuesColumn> | undefined, hiddenSeriesPivotRefs?: PivotReference[]) => string | undefined;
type TooltipFormatterParams = DefaultLabelFormatterCallbackParams & {
    axisId: string;
    axisIndex: number;
    axisType: string;
    axisValue: string | number;
    axisValueLabel: string;
};
/**
 * ECharts tooltip parameter types
 * These represent the structure of params passed to tooltip formatters
 */
export interface TooltipParam {
    seriesName?: string;
    marker?: string;
    encode?: {
        x?: string | number | (string | number)[];
        y?: string | number | (string | number)[];
    };
    dimensionNames?: string[];
    data?: Record<string, unknown>;
    value?: Record<string, unknown> | unknown[];
    axisValue?: string | number;
    axisValueLabel?: string | number;
    name?: string;
}
type TooltipParams = TooltipParam | TooltipParam[];
type GetDimensionNameFn = (param: TooltipParam) => string | undefined;
export declare const isLineSeriesOption: (obj: unknown) => obj is LineSeriesOption;
/**
 * Creates a tooltip formatter for 100% stacked charts
 * This formatter shows both the percentage and the original count value
 *
 * @param originalValues - Map of x-axis values to their original y-values
 * @param getDimensionName - Function to extract the dimension name from a param
 * @param xAxisField - The x-axis field name to extract the raw x value from param data
 * @returns A formatter function compatible with ECharts tooltip
 *
 * @example
 * // SQL Runner usage
 * const formatter = createStack100TooltipFormatter(
 *     originalValues,
 *     (param) => {
 *         const { encode, dimensionNames } = param;
 *         const yFieldIndex = Array.isArray(encode.y) ? encode.y[0] : encode.y;
 *         return dimensionNames?.[yFieldIndex];
 *     },
 *     xFieldId
 * );
 *
 * @example
 * // Explorer usage with flip axes
 * const formatter = createStack100TooltipFormatter(
 *     originalValues,
 *     (param) => {
 *         const { encode, dimensionNames } = param;
 *         if (!dimensionNames || !encode) return undefined;
 *         return flipAxes ? dimensionNames[1] : dimensionNames[encode.y?.[0]];
 *     },
 *     xFieldId
 * );
 */
export declare function createStack100TooltipFormatter(originalValues: Map<string, Map<string, number>>, getDimensionName: GetDimensionNameFn, xAxisField: string, itemsMap?: ItemsMap, xAxisDateFormat?: string, timezone?: string, displayTimezone?: string): (params: TooltipParams) => string;
/**
 * Transform data for 100% stacked charts
 *
 * Converts absolute values to percentages where each stacked group totals 100%.
 * Also preserves original values for tooltip display.
 *
 * @param rows - Array of data rows to transform
 * @param xAxisField - Field reference for the x-axis (grouping key)
 * @param yFieldRefs - Array of field references for y-axis values to convert to percentages
 * @returns Object containing transformed data and original values map
 */
export declare function transformToPercentageStacking<T extends Record<string, unknown>>(rows: T[], xAxisField: string, yFieldRefs: string[]): {
    transformedResults: T[];
    originalValues: Map<string, Map<string, number>>;
};
/**
 * Build a simplified tooltip formatter for SQL Runner Cartesian charts
 * This formatter doesn't require itemsMap and works directly with the dataset
 */
export declare const buildSqlRunnerCartesianTooltipFormatter: ({ stackValue, flipAxes, xFieldId, originalValues, xAxisDateFormat, }: {
    stackValue: string | boolean | undefined;
    flipAxes: boolean | undefined;
    xFieldId: string | undefined;
    originalValues?: Map<string, Map<string, number>> | undefined;
    xAxisDateFormat?: string;
}) => TooltipComponentFormatterCallback<TooltipFormatterParams | TooltipFormatterParams[]>;
export declare const buildCartesianTooltipFormatter: ({ itemsMap, stackValue, flipAxes, xFieldId, originalValues, series, hiddenSeriesPivotRefs, tooltipHtmlTemplate, tooltipSort, pivotValuesColumnsMap, parameters, rows, timezone, displayTimezone, }: {
    itemsMap?: ItemsMap;
    stackValue: string | boolean | undefined;
    flipAxes: boolean | undefined;
    xFieldId: string | undefined;
    originalValues?: Map<string, Map<string, number>> | undefined;
    series?: EChartsSeries[];
    /** Pivot references from hidden series, used for resolving custom tooltip references */
    hiddenSeriesPivotRefs?: PivotReference[];
    tooltipHtmlTemplate?: string;
    tooltipSort?: TooltipSortBy;
    pivotValuesColumnsMap?: Record<string, PivotValuesColumn>;
    parameters?: ParametersValuesMap;
    rows?: (ResultRow | Record<string, unknown>)[];
    timezone?: string;
    displayTimezone?: string;
}) => TooltipComponentFormatterCallback<TooltipFormatterParams | TooltipFormatterParams[]>;
export {};
//# sourceMappingURL=tooltipFormatter.d.ts.map