import { type AnyType } from './any';
import { type DateZoom } from './api/paginatedQuery';
import { type CompactOrAlias, type CompiledCustomDimension, type CompiledDimension, type CompiledMetric, type CompiledTableCalculation, type CustomDimension, type CustomFormat, type Dimension, type FieldId, type Format, type Metric, type MetricType, type TableCalculation } from './field';
import { type Filters, type MetricFilterRule } from './filter';
import { type PeriodOverPeriodComparison } from './periodOverPeriodComparison';
export interface AdditionalMetric {
    label?: string;
    type: MetricType;
    description?: string;
    sql: string;
    hidden?: boolean;
    round?: number;
    compact?: CompactOrAlias;
    format?: Format | string;
    table: string;
    name: string;
    index?: number;
    filters?: MetricFilterRule[];
    baseDimensionName?: string;
    uuid?: string | null;
    percentile?: number;
    formatOptions?: CustomFormat;
}
export declare const isAdditionalMetric: (value: AnyType) => value is AdditionalMetric;
export declare const hasFormatOptions: (value: AnyType) => value is {
    formatOptions: CustomFormat;
};
export declare const getCustomMetricDimensionId: (metric: AdditionalMetric) => string;
export type MetricOverrides = {
    [key: string]: Pick<Metric, 'formatOptions'>;
};
export type DimensionOverrides = {
    [key: string]: Pick<Dimension, 'formatOptions'>;
};
export type MetricQuery = {
    exploreName: string;
    dimensions: FieldId[];
    metrics: FieldId[];
    filters: Filters;
    sorts: SortField[];
    limit: number;
    tableCalculations: TableCalculation[];
    additionalMetrics?: AdditionalMetric[];
    customDimensions?: CustomDimension[];
    metricOverrides?: MetricOverrides;
    dimensionOverrides?: DimensionOverrides;
    timezone?: string;
    metadata?: {
        hasADateDimension: Pick<CompiledDimension, 'label' | 'name' | 'table'>;
    };
    periodOverPeriod?: PeriodOverPeriodComparison;
};
export type CompiledMetricQuery = Omit<MetricQuery, 'customDimensions'> & {
    compiledTableCalculations: CompiledTableCalculation[];
    compiledAdditionalMetrics: CompiledMetric[];
    compiledCustomDimensions: CompiledCustomDimension[];
};
export type SortField = {
    fieldId: string;
    descending: boolean;
    nullsFirst?: boolean;
};
export declare const getAdditionalMetricLabel: (item: AdditionalMetric) => string;
type FilterGroupResponse = {
    id: string;
    or: AnyType[];
} | {
    id: string;
    and: AnyType[];
};
export type FiltersResponse = {
    dimensions?: FilterGroupResponse;
    metrics?: FilterGroupResponse;
    tableCalculations?: FilterGroupResponse;
};
export type MetricQueryResponse = {
    exploreName: string;
    dimensions: FieldId[];
    metrics: FieldId[];
    filters: FiltersResponse;
    sorts: SortField[];
    limit: number;
    tableCalculations: TableCalculation[];
    additionalMetrics?: AdditionalMetric[];
    customDimensions?: CustomDimension[];
    metadata?: {
        hasADateDimension: Pick<CompiledDimension, 'label' | 'name' | 'table'>;
    };
};
export declare const countCustomDimensionsInMetricQuery: (metricQuery: MetricQuery) => {
    numFixedWidthBinCustomDimensions: number;
    numFixedBinsBinCustomDimensions: number;
    numCustomRangeBinCustomDimensions: number;
    numCustomSqlDimensions: number;
};
export declare const hasCustomBinDimension: (metricQuery: MetricQuery | undefined) => boolean | undefined;
export type MetricQueryRequest = {
    exploreName: string;
    dimensions: FieldId[];
    metrics: FieldId[];
    filters: {
        dimensions?: AnyType;
        metrics?: AnyType;
        tableCalculations?: AnyType;
    };
    sorts: SortField[];
    limit: number;
    tableCalculations: TableCalculation[];
    additionalMetrics?: AdditionalMetric[];
    csvLimit?: number;
    customDimensions?: CustomDimension[];
    dateZoom?: DateZoom;
    metadata?: MetricQuery['metadata'];
    timezone?: string;
    metricOverrides?: MetricOverrides;
    dimensionOverrides?: DimensionOverrides;
    periodOverPeriod?: PeriodOverPeriodComparison;
};
export type QueryWarning = {
    message: string;
    fields?: string[];
    tables?: string[];
};
export {};
//# sourceMappingURL=metricQuery.d.ts.map