import { type DbtRawModelNode, type SupportedDbtAdapter } from '../types/dbt';
import { type CompiledExploreJoin, type CompiledTable, type Explore, type ExploreJoin, type Table } from '../types/explore';
import { type CompiledCustomDimension, type CompiledCustomSqlDimension, type CompiledDimension, type CompiledMetric, type CustomDimension, type CustomSqlDimension, type Dimension, type Metric } from '../types/field';
import { type LightdashProjectConfig } from '../types/lightdashProjectConfig';
import { type DateGranularity } from '../types/timeFrames';
import { type WarehouseSqlBuilder } from '../types/warehouse';
export declare const lightdashVariablePattern: RegExp;
type Reference = {
    refTable: string;
    refName: string;
};
type FieldContext = {
    fieldType: 'metric' | 'dimension' | 'custom_dimension' | 'join' | 'sql_where';
    fieldName: string;
};
export declare const getParsedReference: (ref: string, currentTable: string) => Reference;
export declare const getAllReferences: (raw: string) => string[];
export declare const parseAllReferences: (raw: string, currentTable: string) => Reference[];
export type UncompiledExplore = {
    name: string;
    label: string;
    tags: string[];
    baseTable: string;
    groupLabel?: string;
    joinedTables: ExploreJoin[];
    tables: Record<string, Table>;
    targetDatabase: SupportedDbtAdapter;
    sqlWhere?: string;
    warehouse?: string;
    ymlPath?: string;
    sqlPath?: string;
    joinAliases?: Record<string, Record<string, string>>;
    spotlightConfig?: LightdashProjectConfig['spotlight'];
    aiHint?: string | string[];
    meta: DbtRawModelNode['meta'];
    databricksCompute?: string;
    projectParameters?: LightdashProjectConfig['parameters'];
};
/**
 * Options for the ExploreCompiler.
 */
export type ExploreCompilerOptions = {
    /**
     * When enabled, fields that fail to compile will be marked with a
     * compilationError instead of causing the entire explore to fail.
     * This allows users to still access other fields in the explore.
     */
    allowPartialCompilation?: boolean;
};
export declare class ExploreCompiler {
    private readonly warehouseClient;
    private readonly options;
    constructor(warehouseClient: WarehouseSqlBuilder, options?: ExploreCompilerOptions);
    compileExplore({ name, label, tags, baseTable, joinedTables, tables, targetDatabase, groupLabel, warehouse, ymlPath, sqlPath, spotlightConfig, meta, databricksCompute, aiHint, projectParameters, }: UncompiledExplore): Explore;
    /**
     * Creates a dimension with a compilation error marker.
     * Used when partial compilation is enabled and a dimension fails to compile.
     */
    private static createDimensionWithError;
    /**
     * Creates a metric with a compilation error marker.
     * Used when partial compilation is enabled and a metric fails to compile.
     */
    private static createMetricWithError;
    compileTable(table: Table, tables: Record<string, Table>, availableParameters: string[]): CompiledTable;
    private static expandShowUnderlyingValueSets;
    compileMetric(metric: Metric, tables: Record<string, Table>, availableParameters: string[]): CompiledMetric;
    compileMetricSql(metric: Metric, tables: Record<string, Table>, availableParameters: string[]): {
        sql: string;
        tablesReferences: Set<string>;
    };
    compileDimension(dimension: Dimension, tables: Record<string, Table>, availableParameters: string[]): CompiledDimension;
    compileDimensionSql(dimension: Dimension, tables: Record<string, Table>): {
        sql: string;
        tablesReferences: Set<string>;
    };
    compileCustomDimensionSql(dimension: CustomSqlDimension, tables: Record<string, Table>, availableParameters: string[]): Pick<CompiledCustomSqlDimension, 'compiledSql' | 'tablesReferences' | 'parameterReferences'>;
    compileCustomDimension(customDimension: CustomDimension, tables: Record<string, Table>, availableParameters: string[]): CompiledCustomDimension;
    compileDimensionReference(ref: string, tables: Record<string, Table>, currentTable: string, fieldContext?: FieldContext): {
        sql: string;
        tablesReferences: Set<string>;
    };
    compileMetricReference(ref: string, tables: Record<string, Table>, currentTable: string, availableParameters: string[], fieldContext?: FieldContext): {
        sql: string;
        tablesReferences: Set<string>;
    };
    compileExploreJoinSql(join: Pick<ExploreJoin, 'sqlOn' | 'table'>, tables: Record<string, Table>): {
        sql: string;
        tablesReferences: Set<string>;
    };
    compileJoin(join: ExploreJoin, tables: Record<string, Table>, availableParameters: string[]): CompiledExploreJoin;
}
export declare const createDimensionWithGranularity: (dimensionName: string, baseTimeDimension: CompiledDimension, explore: Explore, warehouseSqlBuilder: WarehouseSqlBuilder, granularity: DateGranularity, availableParameters: string[]) => CompiledDimension;
export {};
//# sourceMappingURL=exploreCompiler.d.ts.map