import { type AnyType } from '../../types/any';
import { DimensionType, TableCalculationType } from '../../types/field';
import { type PivotSortAnchor } from '../../types/metricQuery';
import { type PivotConfiguration } from '../../types/pivot';
import { type RawResultRow } from '../../types/results';
import { ChartKind, type PivotReference, type Series } from '../../types/savedCharts';
import { type CartesianChartDisplay } from '../CartesianChartDataModel';
export declare enum VizAggregationOptions {
    SUM = "sum",
    COUNT = "count",
    AVERAGE = "avg",
    MIN = "min",
    MAX = "max",
    ANY = "any"
}
export declare enum SortByDirection {
    ASC = "ASC",
    DESC = "DESC"
}
export declare const vizAggregationOptions: VizAggregationOptions[];
export declare const VIZ_DEFAULT_AGGREGATION = VizAggregationOptions.COUNT;
/**
 * @deprecated Use type ResultColumn
 */
export type VizColumn = {
    reference: string;
    type?: DimensionType;
};
export declare enum VizIndexType {
    TIME = "time",
    CATEGORY = "category"
}
export declare enum AxisSide {
    LEFT = 0,
    RIGHT = 1
}
export declare enum StackType {
    NONE = "none",
    NORMAL = "stack",
    PERCENT = "stack100"
}
export declare function getColumnAxisType(dimensionType: DimensionType): VizIndexType;
export declare function getTableCalculationAxisType(tableCalculationType: TableCalculationType): VizIndexType;
export type VizIndexLayoutOptions = {
    axisType: VizIndexType;
    dimensionType: DimensionType;
    aggregationOptions?: VizAggregationOptions[];
    reference: string;
};
export type VizValuesLayoutOptions = {
    reference: string;
    aggregation: VizAggregationOptions;
    aggregationOptions?: VizAggregationOptions[];
};
export type VizCustomMetricLayoutOptions = VizIndexLayoutOptions & {
    aggregation: VizAggregationOptions;
};
export type VizPivotLayoutOptions = {
    reference: string;
};
export type VizSortBy = {
    reference: string;
    direction: SortByDirection;
    nullsFirst?: boolean;
    /** Pins the row-sort anchor to a specific pivot column. */
    pivotValues?: PivotSortAnchor[];
};
export type VizPieChartDisplay = {
    isDonut?: boolean;
};
export type VizTableDisplay = {};
export type PivotIndexColum = {
    reference: string;
    type: VizIndexType;
};
export type PivotValuesColumn = {
    referenceField: string;
    pivotColumnName: string;
    aggregation: VizAggregationOptions;
    pivotValues: {
        referenceField: string;
        value: unknown;
        formatted?: string;
    }[];
    columnIndex?: number;
};
export type PivotChartData = {
    queryUuid: string | undefined;
    fileUrl: string | undefined;
    results: RawResultRow[];
    indexColumn: PivotConfiguration['indexColumn'] | undefined;
    valuesColumns: PivotValuesColumn[];
    columns: VizColumn[];
    columnCount: number | undefined;
};
export type PivotChartLayout = {
    x: {
        reference: string;
        type: VizIndexType;
    } | undefined;
    y: {
        reference: string;
        aggregation: VizAggregationOptions;
    }[];
    groupBy: {
        reference: string;
    }[] | undefined;
    sortBy?: VizSortBy[];
    stack?: boolean | StackType;
};
export declare const isPivotChartLayout: (obj: PivotChartLayout | VizColumnsConfig | undefined) => obj is PivotChartLayout;
export type VizCartesianChartOptions = {
    indexLayoutOptions: VizIndexLayoutOptions[];
    valuesLayoutOptions: {
        preAggregated: VizValuesLayoutOptions[];
        customAggregations: VizCustomMetricLayoutOptions[];
    };
    pivotLayoutOptions: VizPivotLayoutOptions[];
};
export type VizPieChartOptions = {
    groupFieldOptions: VizIndexLayoutOptions[];
    metricFieldOptions: VizValuesLayoutOptions[];
    customMetricFieldOptions: VizCustomMetricLayoutOptions[];
};
export type VizColumnConfig = {
    visible: boolean;
    reference: string;
    label: string;
    frozen: boolean;
    order?: number;
    aggregation?: VizAggregationOptions;
    displayStyle?: 'text' | 'bar';
    barConfig?: {
        min?: number;
        max?: number;
        color?: string;
    };
};
export type VizColumnsConfig = {
    [key: string]: VizColumnConfig;
};
export type VizTableColumnsConfig = {
    columns: VizColumnsConfig;
};
export type VizTableOptions = {
    defaultColumnConfig: VizTableColumnsConfig['columns'] | undefined;
};
export type VizBaseConfig = {
    metadata: {
        version: number;
    };
    type: ChartKind;
};
export type VizCartesianChartConfig = VizBaseConfig & {
    type: ChartKind.VERTICAL_BAR | ChartKind.LINE;
    fieldConfig: PivotChartLayout | undefined;
    display: CartesianChartDisplay | undefined;
};
export type VizBarChartConfig = VizBaseConfig & {
    type: ChartKind.VERTICAL_BAR;
    fieldConfig: PivotChartLayout | undefined;
    display: CartesianChartDisplay | undefined;
};
export type VizLineChartConfig = VizBaseConfig & {
    type: ChartKind.LINE;
    fieldConfig: PivotChartLayout | undefined;
    display: CartesianChartDisplay | undefined;
};
export type VizPieChartConfig = VizBaseConfig & {
    type: ChartKind.PIE;
    fieldConfig: PivotChartLayout | undefined;
    display: VizPieChartDisplay | undefined;
};
export type VizTableConfig = VizBaseConfig & {
    type: ChartKind.TABLE;
    columns: VizTableColumnsConfig['columns'];
    display: VizTableDisplay | undefined;
};
export type AllVizChartConfig = VizBarChartConfig | VizLineChartConfig | VizPieChartConfig | VizTableConfig;
export declare const isVizBarChartConfig: (value: VizBaseConfig | undefined) => value is VizBarChartConfig;
export declare const isVizLineChartConfig: (value: VizBaseConfig | undefined) => value is VizLineChartConfig;
export declare const isVizCartesianChartConfig: (value: VizBaseConfig | undefined) => value is VizCartesianChartConfig;
export declare const isVizPieChartConfig: (value: VizBaseConfig | undefined) => value is VizPieChartConfig;
export declare const isVizTableConfig: (value: VizBaseConfig | undefined) => value is VizTableConfig;
export type VizConfigErrors = {
    indexFieldError?: {
        reference: string;
    };
    metricFieldError?: {
        references: string[];
    };
    customMetricFieldError?: {
        references: string[];
    };
    groupByFieldError?: {
        references: string[];
    };
};
export type VizTableHeaderSortConfig = {
    [fieldName: string]: {
        direction: SortByDirection | undefined;
    };
};
export type EChartsSeries = {
    type: Series['type'];
    connectNulls?: boolean;
    stack?: string;
    stackLabel?: {
        show?: boolean;
    };
    name?: string;
    color?: string;
    yAxisIndex?: number;
    xAxisIndex?: number;
    encode?: {
        x: string;
        y: string;
        tooltip: string[];
        seriesName: string;
        yRef?: PivotReference;
        xRef?: PivotReference;
    };
    dimensions?: Array<{
        name: string;
        displayName: string;
    }>;
    emphasis?: {
        focus?: string;
    };
    areaStyle?: AnyType;
    pivotReference?: PivotReference;
    label?: {
        show?: boolean;
        fontSize?: number;
        fontWeight?: string;
        position?: 'left' | 'top' | 'right' | 'bottom' | 'inside';
        formatter?: (param: {
            data: Record<string, unknown>;
        }) => string;
    };
    labelLayout?: {
        hideOverlap?: boolean;
    } | ((params: {
        rect: {
            x: number;
            y: number;
            width: number;
            height: number;
        };
        labelRect: {
            x: number;
            y: number;
            width: number;
            height: number;
        };
    }) => {
        x?: number;
        y?: number;
        fontSize?: number;
        labelLinePoints?: number[][];
    } | undefined);
    tooltip?: {
        show?: boolean;
        valueFormatter?: (value: unknown) => string;
    };
    data?: unknown[];
    showSymbol?: boolean;
    symbolSize?: number;
    markLine?: Record<string, unknown>;
    colorBy?: 'series' | 'data';
    itemStyle?: {
        borderRadius?: number | number[];
        color?: string | ((params: {
            dataIndex: number;
            name: string;
            data: Record<string, unknown>;
        }) => string);
        opacity?: number;
    };
    lineStyle?: {
        type?: 'solid' | 'dashed' | 'dotted';
        width?: number;
        color?: string;
        opacity?: number;
    };
    periodOverPeriodMetadata?: {
        siblingSeriesIndex: number;
        periodOffset: number;
        granularity: string;
        /** The field ID of the base metric this PoP series compares against */
        baseFieldId: string;
    };
    clip?: boolean;
};
/**
 * SQL Runner specific EChart series type
 * Extends EChartsSeries but with key differences:
 * - type can be a string (from user config) not just CartesianSeriesType
 * - connectNulls is optional
 * - encode structure is simpler (just x and y, not tooltip/seriesName)
 * - dimensions is a tuple not an array of objects
 * - label formatter has different signature
 * - tooltip valueFormatter is more specific (number not unknown)
 * - adds barCategoryGap for bar charts
 * - excludes pivotReference and markLine
 */
export type SqlRunnerEChartsSeries = Omit<EChartsSeries, 'type' | 'connectNulls' | 'encode' | 'dimensions' | 'label' | 'tooltip' | 'pivotReference' | 'markLine'> & {
    type: string;
    connectNulls?: boolean;
    encode?: {
        x: string | undefined;
        y: string;
    };
    dimensions?: [string | undefined, string];
    label?: {
        show?: boolean;
        fontSize?: number;
        fontWeight?: string;
        position?: string;
        formatter?: (params: AnyType) => string;
    };
    barCategoryGap?: string;
};
//# sourceMappingURL=index.d.ts.map