import { DataSet } from '../DataSet/types';
import { QueryNameSpace, SQLQuery } from '@vizzly/sqlbuilder-public';
export type { QueryNameSpace } from '@vizzly/sqlbuilder-public';
declare type HavingWhere = {
    type: 'having';
    value: QueryNameSpace.Filter<QueryNameSpace.FieldDefinition, string>;
};
export declare type RecursiveHavingFilter = {
    type: 'andHaving' | 'orHaving';
    value: Array<RecursiveHavingFilter>;
} | HavingWhere;
export declare type MeasureDescription = {
    /** What is the underlying field of the data set? */
    field: DataSet.Field;
    /** What function was applied? */
    functionId: string;
};
export declare type SubQuery = {
    measure: [QueryNameSpace.FieldDefinition];
    filter: Query['filter'];
};
/** For when a query cannot be generalised into the TraditionalQuery format. We can provide a very specific query for a specific purpose. */
declare type BasePreparedQuery<PreparedQueryType> = {
    type: 'preparedQuery';
    timeZone?: string;
    preparedQueryType: PreparedQueryType;
};
/** A prepared query that returns unique values for a single array field */
export declare type UniqueArrayValuesQuery = BasePreparedQuery<'uniqueArrayValues'> & {
    dataSetId: string;
    fieldId: string;
    filter: Query['filter'];
};
export declare type PreAggregatedQuery = BasePreparedQuery<'preAggregated'> & {
    dataSetId: string;
    filter: {
        [dataSetId: string]: Query['filter'];
    };
};
export declare type PreparedQuery = UniqueArrayValuesQuery | PreAggregatedQuery;
export declare type Query = Omit<SQLQuery, 'timeZone'> & {
    timeZone?: string;
    having?: RecursiveHavingFilter;
};
