import { type AnyType } from './any';
import { type DimensionType } from './field';
export declare enum FilterType {
    STRING = "string",
    NUMBER = "number",
    DATE = "date",
    BOOLEAN = "boolean"
}
export declare enum FilterOperator {
    NULL = "isNull",
    NOT_NULL = "notNull",
    EQUALS = "equals",
    NOT_EQUALS = "notEquals",
    STARTS_WITH = "startsWith",
    ENDS_WITH = "endsWith",
    INCLUDE = "include",
    NOT_INCLUDE = "doesNotInclude",
    LESS_THAN = "lessThan",
    LESS_THAN_OR_EQUAL = "lessThanOrEqual",
    GREATER_THAN = "greaterThan",
    GREATER_THAN_OR_EQUAL = "greaterThanOrEqual",
    IN_THE_PAST = "inThePast",
    NOT_IN_THE_PAST = "notInThePast",
    IN_THE_NEXT = "inTheNext",
    IN_THE_CURRENT = "inTheCurrent",
    NOT_IN_THE_CURRENT = "notInTheCurrent",
    IN_BETWEEN = "inBetween",
    NOT_IN_BETWEEN = "notInBetween",
    IN_PERIOD_TO_DATE = "inPeriodToDate"
}
export declare const isRelativeDateFilterOperator: (operator: FilterOperator) => boolean;
export type BaseFilterRule<O = FilterOperator, V = unknown> = {
    /** Unique identifier for the filter rule */
    id: string;
    /** Filter operator */
    operator: O;
    /** Values to filter by */
    values?: V[];
    /**
     * For the `equals` operator on string fields, also match rows where the
     * field is null (compiles to `field IN (...) OR field IS NULL`). Lets users
     * combine null with selected values in a single "is" rule.
     */
    includeNull?: boolean;
};
export declare enum UnitOfTime {
    milliseconds = "milliseconds",
    seconds = "seconds",
    minutes = "minutes",
    hours = "hours",
    days = "days",
    weeks = "weeks",
    months = "months",
    quarters = "quarters",
    years = "years"
}
export declare const unitOfTimeFormat: Record<UnitOfTime, string>;
export declare const getUnitsOfTimeGreaterOrEqual: (unit: UnitOfTime) => UnitOfTime[];
export type FieldTarget = {
    /** Field ID to filter on */
    fieldId: string;
};
export interface FilterRule<O = FilterOperator, T = FieldTarget, V = AnyType, S = AnyType> extends BaseFilterRule<O, V> {
    /** Unique identifier for the filter */
    id: string;
    /** Target field for the filter */
    target: T;
    /** Additional settings for date/time filters */
    settings?: S;
    /** Whether this filter is disabled */
    disabled?: boolean;
    /** Whether this filter is required */
    required?: boolean;
    /**
     * Overrides the field/explore case-sensitivity for this rule only.
     * Used by internal features like autocomplete search that must always
     * match case-insensitively regardless of the field's configured setting.
     */
    caseSensitive?: boolean;
}
/** Filter rule for metrics, targeting fields by reference */
export interface MetricFilterRule extends FilterRule<FilterOperator, {
    /** Field reference to filter on (e.g., 'table_name.field_name') */ fieldRef: string;
}> {
}
type JoinModelRequiredFilterTarget = {
    fieldRef: string;
    tableName: string;
};
export interface JoinModelRequiredFilterRule extends FilterRule<FilterOperator, JoinModelRequiredFilterTarget> {
}
export type ModelRequiredFilterRule = MetricFilterRule | JoinModelRequiredFilterRule;
export declare const isJoinModelRequiredFilter: (filter: ModelRequiredFilterRule) => filter is JoinModelRequiredFilterRule;
export type DashboardFieldTarget = {
    fieldId: string;
    tableName: string;
    isSqlColumn?: boolean;
    fallbackType?: DimensionType;
};
export declare const isDashboardFieldTarget: (target: unknown) => target is DashboardFieldTarget;
export type DashboardTileTarget = DashboardFieldTarget | false;
export type DashboardFilterRule<O = FilterOperator, T extends DashboardFieldTarget = DashboardFieldTarget, V = AnyType, S = AnyType> = FilterRule<O, T, V, S> & {
    tileTargets?: Record<string, DashboardTileTarget>;
    label: undefined | string;
    singleValue?: boolean;
    /**
     * Tab UUIDs where this filter is locked. When the active tab is in this
     * list, viewers see the filter but cannot change it, and URL / embed
     * filter overrides targeting the same field are ignored on that tab.
     * Empty or omitted means the filter is not locked anywhere.
     */
    lockedTabUuids?: string[];
};
export type FilterDashboardToRule = DashboardFilterRule & {
    target: {
        fieldName: string;
    };
};
export type DashboardFilterRuleOverride = Omit<DashboardFilterRule, 'tileTargets' | 'lockedTabUuids'>;
export type DateFilterSettings = {
    /** Time unit for relative date filters */
    unitOfTime?: UnitOfTime;
    /** For date filters, whether to include completed periods */
    completed?: boolean;
};
export type DateFilterRule = FilterRule<FilterOperator, unknown, AnyType, DateFilterSettings>;
export declare const isDateFilterRule: (filter: FilterRule<FilterOperator, FieldTarget | unknown, AnyType, AnyType>) => filter is DateFilterRule;
export type FilterGroupItem = FilterGroup | FilterRule;
export type OrFilterGroup = {
    /** Unique identifier for the filter group */
    id: string;
    /** Array of filters or nested groups combined with OR logic */
    or: Array<FilterGroupItem>;
};
export type AndFilterGroup = {
    /** Unique identifier for the filter group */
    id: string;
    /** Array of filters or nested groups combined with AND logic */
    and: Array<FilterGroupItem>;
};
export type FilterGroup = OrFilterGroup | AndFilterGroup;
export type Filters = {
    /** Dimension filter group */
    dimensions?: FilterGroup;
    /** Metric filter group */
    metrics?: FilterGroup;
    /** Table calculation filter group */
    tableCalculations?: FilterGroup;
};
export type DashboardFilters = {
    dimensions: DashboardFilterRule[];
    metrics: DashboardFilterRule[];
    tableCalculations: DashboardFilterRule[];
};
export type DashboardFiltersFromSearchParam = {
    dimensions: (Omit<DashboardFilterRule, 'tileTargets'> & {
        tileTargets?: (string | Record<string, DashboardTileTarget>)[];
    })[];
    metrics: (Omit<DashboardFilterRule, 'tileTargets'> & {
        tileTargets?: (string | Record<string, DashboardTileTarget>)[];
    })[];
    tableCalculations: (Omit<DashboardFilterRule, 'tileTargets'> & {
        tileTargets?: (string | Record<string, DashboardTileTarget>)[];
    })[];
};
export declare const isOrFilterGroup: (value: FilterGroupItem) => value is OrFilterGroup;
export declare const isAndFilterGroup: (value: FilterGroupItem) => value is AndFilterGroup;
export declare const isFilterGroup: (value: FilterGroupItem) => value is FilterGroup;
export declare const isFilterRule: (value: BaseFilterRule | FilterGroupItem) => value is FilterRule;
export declare const isFilterTarget: (value: unknown) => value is FieldTarget;
export declare const isMetricFilterTarget: (value: unknown) => value is {
    fieldRef: string;
};
export declare const flattenFilterGroup: (filterGroup: FilterGroup) => FilterRule[];
export declare const getFilterRules: (filters: Filters) => FilterRule[];
export declare const updateFieldIdInFilterGroupItem: (filterGroupItem: FilterGroupItem, previousName: string, newName: string) => void;
export declare const updateFieldIdInFilters: (filterGroup: FilterGroup | undefined, previousName: string, newName: string) => void;
export declare const removeFieldFromFilterGroup: (filterGroup: FilterGroup | undefined, fieldId: string) => FilterGroup | undefined;
export declare const applyDimensionOverrides: (dashboardFilters: DashboardFilters, overrides: DashboardFilters | DashboardFilterRule[]) => DashboardFilterRule<FilterOperator, DashboardFieldTarget, any, any>[];
export declare const isDashboardFilterRule: (value: BaseFilterRule) => value is DashboardFilterRule;
export declare enum FilterGroupOperator {
    and = "and",
    or = "or"
}
export declare const convertDashboardFiltersToFilters: (dashboardFilters: DashboardFilters) => Filters;
export declare const convertDashboardFiltersParamToDashboardFilters: (dashboardFilters: DashboardFiltersFromSearchParam) => DashboardFilters;
export declare const compressDashboardFiltersToParam: (dashboardFilters: DashboardFilters) => DashboardFiltersFromSearchParam;
export declare const isFilterRuleDefinedForFieldId: (filterGroup: FilterGroup, fieldId: string, isInterval?: boolean) => boolean;
/**
 * Type tracking time-based filter overrides using an external map instead of modifying filter rules
 * Maps dashboard filter rule IDs to their override configurations
 */
export type TimeBasedOverrideMap = Record<string, {
    baseTimeDimensionName: string;
    fieldsToChange: string[];
}>;
export {};
//# sourceMappingURL=filter.d.ts.map