import { type Arg, type ArgValue, Attribute, Filter, FilterRelations, type FunctionCall, JaqlDataSourceForDto, JSONArray, Measure, PivotGrandTotals } from '@sisense/sdk-data';
import { CategoryStyle, SeriesStyle, ValueStyle } from '../../../domains/visualizations/core/chart-data-options/types.js';
import type { PivotTableStyleOptions } from '../../../types.js';
import { DataSchemaContext, NlqTranslationInput } from '../types.js';
import type { SchemaIndex } from './shared/utils/schema-index.js';
/**
 * Internal context type that uses schemaIndex for efficient lookups
 * @internal
 */
export interface InternalDataSchemaContext {
    /** The data source being used for the query */
    dataSource: JaqlDataSourceForDto;
    /** Schema index for efficient table/column lookups */
    schemaIndex: SchemaIndex;
    /** Chart type for axis-specific translation (e.g., pivot columns, boxplot value) */
    chartType?: string;
}
export declare const DIMENSIONAL_NAME_PREFIX = "DM.";
/** Re-exported from `@sisense/sdk-data` (compose-code parse tree). */
export type { Arg, ArgValue, FunctionCall };
export type ArgType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'Attribute' | 'Attribute[]' | 'Measure' | 'BaseMeasure' | 'Measure[]' | 'Filter' | 'Filter[]' | 'FilterRelationsNode' | 'DateDimension' | 'LevelAttribute' | 'Measure | number' | 'Date | string' | 'string | number' | 'BaseFilterConfig' | 'MembersFilterConfig' | 'CustomFormulaContext' | 'any';
export interface ArgSchema {
    type: ArgType;
    required: boolean;
}
export type ProcessedArg = unknown;
export type QueryElement = Filter | FilterRelations | Measure;
export type FactoryFunction = (...args: unknown[]) => QueryElement;
/**
 * Context object passed to all custom processors containing runtime information
 * needed for processing.
 * @internal
 */
export interface FunctionContext extends InternalDataSchemaContext {
    /** Path prefix for error messages (e.g., 'args[0].function') */
    pathPrefix: string;
}
export interface ArgContext extends FunctionContext {
    argSchema: ArgSchema;
}
export type DimensionsInput = NlqTranslationInput<JSONArray, InternalDataSchemaContext>;
export type MeasuresInput = NlqTranslationInput<JSONArray, InternalDataSchemaContext>;
export type FiltersInput = NlqTranslationInput<JSONArray, InternalDataSchemaContext>;
export type HighlightsInput = NlqTranslationInput<JSONArray, InternalDataSchemaContext>;
export type MeasuresFunctionCallInput = NlqTranslationInput<FunctionCall[], InternalDataSchemaContext>;
export type FiltersFunctionCallInput = NlqTranslationInput<FunctionCall[], InternalDataSchemaContext>;
export type HighlightsFunctionCallInput = NlqTranslationInput<FunctionCall[], InternalDataSchemaContext>;
export type NodeInput = NlqTranslationInput<FunctionCall, FunctionContext>;
export type ArgInput = NlqTranslationInput<Arg, ArgContext>;
/**
 * Custom processor function signature.
 */
export type CustomFunctionProcessor = (processedArgs: ProcessedArg[], context: FunctionContext) => void;
/**
 * Type guard: value is a non-null object (Record<string, unknown>).
 * @internal
 */
export declare function isRecordStringUnknown(value: unknown): value is Record<string, unknown>;
export declare function isFunctionCall(value: unknown): value is FunctionCall;
export declare function isFunctionCallArray(value: JSONArray): value is FunctionCall[];
export declare function isFilterElement(arg: QueryElement): arg is Filter;
export declare function isFilterRelationsElement(arg: QueryElement): arg is FilterRelations;
export declare function isMeasureElement(arg: QueryElement): arg is Measure;
export declare function isStringArray(value: JSONArray): value is string[];
/**
 * Enriched dimension translation result. Style uses CategoryStyle (same as StyledColumn).
 *
 * @internal
 */
export type DimensionTranslationItem = {
    attribute: Attribute;
    style?: CategoryStyle;
};
/**
 * Enriched measure translation result. Style uses ValueStyle & SeriesStyle (same as StyledMeasureColumn).
 *
 * @internal
 */
export type MeasureTranslationItem = {
    measure: Measure;
    style?: ValueStyle & SeriesStyle;
};
/**
 * JSON-facing type for a styled dimension/attribute.
 * Reusable for query JSON and future chart JSON (translateChartFromJSON).
 *
 * @internal
 */
export interface StyledColumnJSON extends CategoryStyle {
    /** Attribute reference (composeCode), e.g. "DM.Commerce.Gender" */
    column: string;
}
/**
 * JSON-facing type for a styled measure.
 * Reusable for query JSON and future chart JSON (translateChartFromJSON).
 *
 * @internal
 */
export interface StyledMeasureColumnJSON extends ValueStyle, SeriesStyle {
    /** Measure definition (function/args), e.g. { function: "measureFactory.sum", args: [...] } */
    column: FunctionCall;
}
/**
 * Dimension item in query JSON: plain composeCode string or styled column.
 *
 * @internal
 */
export type DimensionItemJSON = string | StyledColumnJSON;
/**
 * Measure item in query JSON: plain function call or styled measure.
 *
 * @internal
 */
export type MeasureItemJSON = FunctionCall | StyledMeasureColumnJSON;
/**
 * Type guard: value is StyledColumnJSON (object with column, not a FunctionCall).
 *
 * @internal
 */
export declare function isStyledColumnJSON(value: unknown): value is StyledColumnJSON;
/**
 * Type guard: value is StyledMeasureColumnJSON (object with column containing a measure definition).
 *
 * @internal
 */
export declare function isStyledMeasureColumnJSON(value: unknown): value is StyledMeasureColumnJSON;
/**
 * JSON representation of chart data options.
 * Maps axis names to arrays of dimension or measure items.
 * Supports all chart types (cartesian, categorical, scatter, etc.).
 *
 * @internal
 */
export interface DataOptionsJSON {
    category?: DimensionItemJSON[];
    /** Array for cartesian/categorical; single for calendar-heatmap */
    value?: MeasureItemJSON[] | MeasureItemJSON;
    breakBy?: DimensionItemJSON[];
    x?: DimensionItemJSON | MeasureItemJSON;
    y?: DimensionItemJSON | MeasureItemJSON;
    breakByPoint?: DimensionItemJSON;
    breakByColor?: DimensionItemJSON | MeasureItemJSON;
    size?: MeasureItemJSON;
    boxType?: MeasureItemJSON;
    outliers?: MeasureItemJSON[];
    geo?: DimensionItemJSON[];
    colorBy?: MeasureItemJSON;
    details?: DimensionItemJSON;
    color?: MeasureItemJSON[];
    date?: DimensionItemJSON;
    columns?: (DimensionItemJSON | MeasureItemJSON)[];
    rows?: DimensionItemJSON[];
    values?: MeasureItemJSON[];
    secondary?: MeasureItemJSON[];
    min?: MeasureItemJSON[];
    max?: MeasureItemJSON[];
}
/**
 * JSON representation of a chart configuration from NLQ API.
 * Matches the structure returned by NLQ v3 for chart recommendations.
 * Reusable for chart JSON translation (translateChartFromJSON/translateChartToJSON).
 *
 * @internal
 */
export interface ChartJSON {
    /** Chart type (e.g., 'column', 'line', 'bar', 'pie', 'scatter') */
    chartType: string;
    /** Data options mapping chart axes to dimensions/measures */
    dataOptions: DataOptionsJSON;
    /** Optional style options for chart appearance (colors, legend, axes, etc.) */
    styleOptions?: Record<string, unknown>;
    /** Optional filters to apply to the chart data */
    filters?: FunctionCall[];
    /** Optional highlights (filter criteria) to apply to the chart */
    highlights?: FunctionCall[];
}
/**
 * Input type for chart translation (JSON → CSDK).
 * Combines chartJSON with data schema context.
 *
 * @internal
 */
export type ChartInput = NlqTranslationInput<ChartJSON, DataSchemaContext>;
/**
 * JSON representation of pivot table data options.
 *
 * @internal
 */
export interface PivotTableDataOptionsJSON {
    rows?: DimensionItemJSON[];
    columns?: DimensionItemJSON[];
    values?: MeasureItemJSON[];
    grandTotals?: PivotGrandTotals;
}
/**
 * JSON representation of pivot table config from NLQ API.
 *
 * @internal
 */
export interface PivotTableJSON {
    dataOptions: PivotTableDataOptionsJSON;
    styleOptions?: PivotTableStyleOptions;
    filters?: FunctionCall[];
    highlights?: FunctionCall[];
}
/**
 * Input type for pivot table translation (JSON → CSDK).
 *
 * @internal
 */
export type PivotTableInput = NlqTranslationInput<PivotTableJSON, DataSchemaContext>;
