import { JaqlDataSourceForDto, JSONArray, MetadataItem } from '@sisense/sdk-data';
import type { DashboardByIdConfig } from '../../domains/dashboarding';
import { DashboardProps } from '../../domains/dashboarding/types.js';
import { ExecutePivotQueryParams, ExecuteQueryParams } from '../../domains/query-execution/index.js';
import { AnyColumn } from '../../domains/visualizations/core/chart-data-options/types.js';
import { DynamicChartType } from '../../domains/visualizations/core/chart-options-processor/translations/types.js';
import { ChartWidgetProps } from '../../domains/widgets/components/chart-widget/types';
import { PivotTableWidgetProps } from '../../domains/widgets/components/pivot-table-widget/types';
import { WidgetProps } from '../../domains/widgets/components/widget/types';
import { ChartDataOptions, ChartStyleOptions } from '../../types';
type Stringify<T> = {
    [K in keyof T as `${K & string}String`]: string;
};
type ExtraWidgetCodeProps = {
    componentString: string;
    extraImportsString: string;
    idString?: string;
    widgetTypeString?: 'chart' | 'pivot' | 'text' | 'custom';
};
/** @internal */
export type KeysOfUnion<T> = T extends T ? keyof T : never;
/** @internal */
export type AllPossibleChartOptionKeys = KeysOfUnion<ChartDataOptions>;
/** @internal */
export type AxesMappingKey = Exclude<AllPossibleChartOptionKeys, 'seriesToColorMap'>;
/** @internal */
export type AxesMapping = Partial<Record<AxesMappingKey, Array<AnyColumn>>>;
/** @internal */
export interface ChartRecommendations {
    chartFamily: string;
    chartType: string;
    axesMapping: AxesMapping;
    styleOptions?: ChartStyleOptions;
}
/**
 * Expanded Query Model that is based on NlqResponseData.
 * It contains expanded JAQL and chart recommendations returned from the chat response.
 *
 * @internal
 */
export interface ExpandedQueryModel {
    /** @internal */
    chartRecommendations: ChartRecommendations | {};
    /** @internal */
    jaql: {
        datasource: {
            id?: string;
            type?: 'elasticube' | 'live';
            title: string;
        };
        metadata: MetadataItem[];
    };
    /** @internal */
    queryTitle: string;
}
/**
 * Empty Expanded Query Model
 *
 * Used as a default value for ExpandedQueryModel
 *
 * @internal
 */
export declare const EMPTY_EXPANDED_QUERY_MODEL: ExpandedQueryModel;
/**
 * Simple Chart Recommendations
 *
 * @internal
 */
export interface SimpleChartRecommendations {
    chartType: string;
    dataOptions: AxesMapping;
    styleOptions: ChartStyleOptions;
}
/**
 * Simple Query Model that is a simplified version of ExpandedQueryModel.
 *
 * It removes any JAQL syntax or information that already exists in the schema.
 * Also, any parameters that have a default do not need to be specified.
 *
 * Users manipulates this model via the query in YAML format.
 *
 * QueryTranslator is responsible for translating this query model to ExpandedWidgetModel.
 *
 * @internal
 */
export interface SimpleQueryModel {
    /**
     * The data model or perspective title.
     */
    model: string;
    metadata: MetadataItem[];
    chart: SimpleChartRecommendations | {};
    /**
     * Title of the query
     */
    queryTitle: string;
}
/**
 * Empty Simple Query Model
 *
 * Used as a default value for SimpleQueryModel
 *
 * @internal
 */
export declare const EMPTY_SIMPLE_QUERY_MODEL: SimpleQueryModel;
/**
 * UI Framework
 *
 * @internal
 */
export type UiFramework = 'react' | 'vue' | 'angular';
/**
 * Code Template Key
 *
 * @internal
 */
export type CodeTemplateKey = 'baseChartTmpl' | 'chartTmpl' | 'chartWidgetTmpl' | 'chartWidgetPropsTmpl' | 'widgetByIdTmpl' | 'executeQueryByWidgetIdTmpl' | 'executeQueryTmpl' | 'executePivotQueryTmpl' | 'pivotTableWidgetTmpl' | 'pivotTableWidgetPropsTmpl' | 'dashboardByIdTmpl' | 'dashboardTmpl';
/**
 * Code Templates
 *
 * @internal
 */
export type CodeTemplates = {
    [key in UiFramework]: {
        [key in CodeTemplateKey]: string;
    };
};
/**
 * Code Placeholder Map
 *
 * @internal
 */
export type CodePlaceholderMap = Record<string, string>;
/**
 * Base Code Config
 *
 * @internal
 */
export type BaseCodeConfig = {
    uiFramework?: UiFramework;
};
/** TYPES FOR WIDGET CODE */
/**
 * Widget Code Config
 *
 * @internal
 */
export type WidgetCodeConfig = BaseCodeConfig & {
    includeChart?: boolean;
};
/**
 * Client-side Widget Code Params
 *
 * @internal
 */
export type ClientSideWidgetCodeParams = BaseCodeConfig & {
    widgetProps: WidgetProps;
    removeDefaultProps?: boolean;
};
/**
 * By ID Widget Code Params
 *
 * @internal
 */
export type ByIdWidgetCodeParams = WidgetCodeConfig & {
    dashboardOid: string;
    widgetOid: string;
    chartType: DynamicChartType;
};
/**
 * Widget Code Params
 *
 * @internal
 */
export type WidgetCodeParams = ClientSideWidgetCodeParams | ByIdWidgetCodeParams;
/**
 * Check if widget code params is for client-side code
 *
 * @internal
 */
export declare const isClientSideWidgetCodeParams: (params: WidgetCodeParams) => params is ClientSideWidgetCodeParams;
/**
 * Check if widget code params is for by ID code
 *
 * @internal
 */
export declare const isByIdWidgetCodeParams: (params: WidgetCodeParams) => params is ByIdWidgetCodeParams;
/**
 * Widget Props Config
 *
 * @internal
 */
export type WidgetPropsConfig = {
    useCustomizedStyleOptions?: boolean;
};
/**
 * Execute Query Code Params
 *
 * @internal
 */
export type ExecuteQueryCodeParams = BaseCodeConfig & {
    queryParams: ExecuteQueryParams;
};
/**
 * Execute Pivot Query Code Params
 *
 * @internal
 */
export type ExecutePivotQueryCodeParams = BaseCodeConfig & {
    pivotQueryParams: ExecutePivotQueryParams;
};
/**
 * Execute Query Code Props
 *
 * @internal
 */
export type ExecuteQueryCodeProps = Stringify<ExecuteQueryParams> & {
    extraImportsString: string;
};
/**
 * @internal
 */
export type ExecutePivotQueryCodeProps = Stringify<ExecutePivotQueryParams> & {
    extraImportsString: string;
};
/**
 * Chart Widget Code Props
 *
 * @internal
 */
export type ChartWidgetCodeProps = Stringify<ChartWidgetProps> & ExtraWidgetCodeProps;
/**
 * Pivot Table Widget Code Props
 *
 * @internal
 */
export type PivotTableWidgetCodeProps = Stringify<PivotTableWidgetProps> & ExtraWidgetCodeProps;
/**
 * Template Key by Widget Type
 *
 * @internal
 */
export type TemplateKeyMapByWidgetType = {
    chart: CodeTemplateKey;
    pivot: CodeTemplateKey;
    text?: CodeTemplateKey;
    custom?: CodeTemplateKey;
};
/** TYPE FOR DASHBOARD CODE */
/**
 * Dashboard Code Config
 *
 * @internal
 */
export type DashboardCodeConfig = BaseCodeConfig;
/**
 * Client-side Dashboard Code Params
 *
 * @internal
 */
export type ClientSideDashboardCodeParams = BaseCodeConfig & {
    dashboardProps: DashboardProps;
};
/**
 * By ID Dashboard Code Params
 *
 * @internal
 */
export type ByIdDashboardCodeParams = DashboardCodeConfig & {
    dashboardOid: string;
    config?: DashboardByIdConfig;
};
/**
 * Dashboard Code Params
 *
 * @internal
 */
export type DashboardCodeParams = ClientSideDashboardCodeParams | ByIdDashboardCodeParams;
/**
 * Check if dashboard code params is for client-side code
 *
 * @internal
 */
export declare const isClientSideDashboardCodeParams: (params: DashboardCodeParams) => params is ClientSideDashboardCodeParams;
/**
 * Check if dashboard code params is for by ID code
 *
 * @internal
 */
export declare const isByIdDashboardCodeParams: (params: DashboardCodeParams) => params is ByIdDashboardCodeParams;
/**
 * Dashboard Code Props
 *
 * @internal
 */
export type DashboardCodeProps = Stringify<DashboardProps> & ExtraWidgetCodeProps;
/**
 * @internal
 */
export type NormalizedColumn = {
    name: string;
    dataType: string;
    expression: string;
    description?: string;
};
/**
 * @internal
 */
export type NormalizedTable = {
    name: string;
    columns: NormalizedColumn[];
};
/**
 * NLQ generic input with context for translation
 *
 * @internal
 */
export type NlqTranslationInput<DataType, ContextType> = {
    data: DataType;
    context: ContextType;
};
/**
 * Response JSON generated by the new NLQ API.
 *
 * @internal
 */
export type NlqResponseJSON = {
    dimensions: JSONArray;
    measures: JSONArray;
    filters: JSONArray;
    highlights?: JSONArray;
};
/**
 * Data schema context for translation
 *
 * @internal
 */
export interface DataSchemaContext {
    /** The data source being used for the query */
    dataSource: JaqlDataSourceForDto;
    /** Available tables for attribute resolution */
    tables: NormalizedTable[];
}
/**
 * Query input for translation
 *
 * @internal
 */
export type QueryInput = NlqTranslationInput<NlqResponseJSON, DataSchemaContext>;
/**
 * Context information for error generation
 *
 * @internal
 */
export type NlqTranslationErrorContext = {
    /** The category of the query/chart element that failed (dimensions, measures, filters, highlights, dataOptions, chartType, styleOptions) */
    category: 'dimensions' | 'measures' | 'filters' | 'highlights' | 'dataOptions' | 'chartType' | 'styleOptions';
    /** The index of the element within its category array, or axis key for dataOptions (e.g. "category", "value") */
    index: number | string;
    /** The complete original input that caused the error */
    input: unknown;
};
/**
 * Structured error information for translation failures.
 *
 * @internal
 */
export type NlqTranslationError = NlqTranslationErrorContext & {
    /** Human-readable error message describing what went wrong */
    message: string;
};
/**
 * Structured error response format for translation failures.
 *
 * @internal
 */
export type NlqTranslationErrorResult = {
    success: false;
    errors: NlqTranslationError[];
};
/**
 * Success response format for translation operations.
 *
 * @internal
 */
export type NlqTranslationSuccessResult<T> = {
    success: true;
    data: T;
};
/**
 * Represents the result of a translation operation that can either succeed with data or fail with errors.
 *
 * @internal
 */
export type NlqTranslationResult<T> = NlqTranslationSuccessResult<T> | NlqTranslationErrorResult;
export {};
