import { type Action, type CaseReducer } from "@reduxjs/toolkit";
import { type IAttributeWithReferences } from "@gooddata/sdk-backend-spi";
import { type DashboardAttributeFilterItem, type DashboardAttributeFilterSelectionMode, type DashboardTextAttributeFilter, type DateFilterGranularity, type DateFilterType, type DateString, type EmptyValues, type FilterContextItem, type IAttributeDisplayFormMetadataObject, type IAttributeElements, type IDashboardAttributeFilterByDate, type IDashboardAttributeFilterParent, type IDashboardObjectIdentity, type IFilterContextDefinition, type ILowerBoundedFilter, type IUpperBoundedFilter, type MeasureValueFilterCondition, type ObjRef } from "@gooddata/sdk-model";
import { type IAddDateFilterPayload, type IAddMeasureValueFilterPayload } from "../../../commands/filters.js";
import { type ITabsState } from "../tabsState.js";
type FilterContextReducer<A extends Action> = CaseReducer<ITabsState, A>;
type SetFilterContextPayload = {
    filterContextDefinition: IFilterContextDefinition;
    originalFilterContextDefinition?: IFilterContextDefinition;
    attributeFilterDisplayForms: IAttributeDisplayFormMetadataObject[];
    filterContextIdentity?: IDashboardObjectIdentity;
};
type SetFilterContextIdentityPayload = {
    filterContextIdentity?: IDashboardObjectIdentity;
};
/**
 * Payload for updating filter context identity for a specific tab.
 */
type UpdateFilterContextIdentityForTabPayload = {
    tabId: string;
    filterContextIdentity?: IDashboardObjectIdentity;
};
/**
 * @internal
 */
export interface IAddAttributeFilterDisplayFormPayload {
    readonly displayForm: IAttributeDisplayFormMetadataObject;
    /**
     * Optional tab local identifier to target a specific tab.
     * If not provided, the active tab will be used.
     */
    readonly tabLocalIdentifier?: string;
}
/**
 * @internal
 */
export interface IUpsertDateFilterAllTimePayload {
    readonly type: "allTime";
    readonly dataSet?: ObjRef;
    readonly isWorkingSelectionChange?: boolean;
    readonly localIdentifier?: string;
    readonly emptyValueHandling?: EmptyValues;
    /**
     * Optional tab local identifier to target a specific tab.
     * If not provided, the active tab will be used.
     */
    readonly tabLocalIdentifier?: string;
}
/**
 * @internal
 */
export interface IUpsertDateFilterNonAllTimePayload {
    readonly type: DateFilterType;
    readonly granularity: DateFilterGranularity;
    readonly dataSet?: ObjRef;
    readonly from?: DateString | number;
    readonly to?: DateString | number;
    readonly isWorkingSelectionChange?: boolean;
    readonly localIdentifier?: string;
    readonly boundedFilter?: IUpperBoundedFilter | ILowerBoundedFilter;
    readonly emptyValueHandling?: EmptyValues;
    /**
     * Optional tab local identifier to target a specific tab.
     * If not provided, the active tab will be used.
     */
    readonly tabLocalIdentifier?: string;
}
/**
 * @internal
 */
export type IUpsertDateFilterPayload = IUpsertDateFilterAllTimePayload | IUpsertDateFilterNonAllTimePayload;
/**
 * @internal
 */
export interface IUpdateAttributeFilterSelectionPayload {
    readonly filterLocalId: string;
    readonly elements: IAttributeElements;
    readonly negativeSelection: boolean;
    readonly isWorkingSelectionChange?: boolean;
    readonly enableImmediateAttributeFilterDisplayAsLabelMigration?: boolean;
    readonly isResultOfMigration?: boolean;
    readonly isSelectionInvalid?: boolean;
    /**
     * Optional tab local identifier to target a specific tab.
     * If not provided, the active tab will be used.
     */
    readonly tabLocalIdentifier?: string;
}
/**
 * Payload for replacing an attribute filter item (standard, arbitrary, or match) in the filter context.
 * @internal
 */
export interface IReplaceAttributeFilterItemPayload {
    readonly filterLocalId: string;
    readonly filter: DashboardAttributeFilterItem;
    readonly isWorkingSelectionChange?: boolean;
    readonly isSelectionInvalid?: boolean;
    /**
     * Optional tab local identifier to target a specific tab.
     * If not provided, the active tab will be used.
     */
    readonly tabLocalIdentifier?: string;
}
/**
 * @internal
 */
export interface IAddAttributeFilterPayload {
    readonly displayForm: ObjRef;
    readonly index: number;
    readonly parentFilters?: ReadonlyArray<IDashboardAttributeFilterParent>;
    readonly initialSelection?: IAttributeElements;
    readonly initialIsNegativeSelection?: boolean;
    readonly selectionMode?: DashboardAttributeFilterSelectionMode;
    readonly localIdentifier?: string;
    readonly title?: string;
}
/**
 * @internal
 */
export interface IAddTextAttributeFilterReducerPayload {
    readonly filter: DashboardTextAttributeFilter;
    readonly index: number;
}
/**
 * @internal
 */
export interface IRemoveAttributeFilterPayload {
    readonly filterLocalId: string;
}
/**
 * @internal
 */
export interface IMoveAttributeFilterPayload {
    readonly filterLocalId: string;
    readonly index: number;
}
/**
 * @internal
 */
export interface ISetAttributeFilterParentsPayload {
    readonly filterLocalId: string;
    readonly parentFilters: ReadonlyArray<IDashboardAttributeFilterParent>;
}
/**
 * @internal
 */
export interface ISetAttributeFilterDependentDateFiltersPayload {
    readonly filterLocalId: string;
    readonly dependentDateFilters: ReadonlyArray<IDashboardAttributeFilterByDate>;
}
/**
 * @internal
 */
export interface IClearAttributeFiltersSelectionPayload {
    readonly filterLocalIds: string[];
    /**
     * Optional tab local identifier to target a specific tab.
     * If not provided, the active tab will be used.
     */
    readonly tabLocalIdentifier?: string;
}
/**
 * @internal
 */
export interface IChangeAttributeDisplayFormPayload {
    readonly filterLocalId: string;
    readonly displayForm: ObjRef;
    readonly isWorkingSelectionChange?: boolean;
    readonly enableImmediateAttributeFilterDisplayAsLabelMigration?: boolean;
    readonly isResultOfMigration?: boolean;
    /**
     * Optional tab local identifier to target a specific tab.
     * If not provided, the active tab will be used.
     */
    readonly tabLocalIdentifier?: string;
}
/**
 * @internal
 */
export interface IChangeTextFilterDisplayFormPayload {
    readonly filterLocalId: string;
    readonly displayForm: ObjRef;
    readonly tabLocalIdentifier?: string;
}
/**
 * @internal
 */
export interface IChangeAttributeTitlePayload {
    readonly filterLocalId: string;
    readonly title?: string;
}
/**
 * @internal
 */
export interface IChangeAttributeSelectionModePayload {
    readonly filterLocalId: string;
    readonly selectionMode: DashboardAttributeFilterSelectionMode;
}
/**
 * @internal
 */
export interface IRemoveMeasureValueFilterReducerPayload {
    readonly localIdentifier: string;
}
/**
 * @internal
 */
export interface IMoveMeasureValueFilterPayload {
    readonly localIdentifier: string;
    readonly index: number;
}
/**
 * @internal
 */
export interface IRemoveDateFilterPayload {
    readonly dataSet: ObjRef;
}
/**
 * @internal
 */
export interface IMoveDateFilterPayload {
    readonly dataSet: ObjRef;
    readonly index: number;
}
/**
 * @internal
 */
export interface IChangeAttributeLimitingItemsPayload {
    readonly filterLocalId: string;
    readonly limitingItems: ObjRef[];
}
/**
 * @internal
 */
export interface IApplyWorkingSelectionPayload {
    readonly enableImmediateAttributeFilterDisplayAsLabelMigration?: boolean;
}
/**
 * @internal
 */
export type IChangeMeasureValueFilterConditionReducerPayload = {
    readonly localIdentifier: string;
    readonly conditions?: MeasureValueFilterCondition[];
    readonly isWorkingSelectionChange?: boolean;
};
type IChangeMeasureValueFilterTitleReducerPayload = {
    readonly filterLocalId: string;
    readonly title?: string;
};
export declare const filterContextReducers: {
    setFilterContext: FilterContextReducer<{
        payload: SetFilterContextPayload;
        type: string;
    }>;
    updateFilterContextIdentity: FilterContextReducer<{
        payload: SetFilterContextIdentityPayload;
        type: string;
    }>;
    updateFilterContextIdentityForTab: FilterContextReducer<{
        payload: UpdateFilterContextIdentityForTabPayload;
        type: string;
    }>;
    removeAttributeFilterDisplayForms: FilterContextReducer<{
        payload: ObjRef;
        type: string;
    }>;
    addAttributeFilterDisplayForm: FilterContextReducer<{
        payload: IAddAttributeFilterDisplayFormPayload | IAttributeDisplayFormMetadataObject;
        type: string;
    }>;
    addAttributeFilter: FilterContextReducer<{
        payload: IAddAttributeFilterPayload;
        type: string;
    }>;
    addTextAttributeFilter: FilterContextReducer<{
        payload: IAddTextAttributeFilterReducerPayload;
        type: string;
    }>;
    addMeasureValueFilter: FilterContextReducer<{
        payload: IAddMeasureValueFilterPayload;
        type: string;
    }>;
    removeMeasureValueFilter: FilterContextReducer<{
        payload: IRemoveMeasureValueFilterReducerPayload;
        type: string;
    }>;
    moveMeasureValueFilter: FilterContextReducer<{
        payload: IMoveMeasureValueFilterPayload;
        type: string;
    }>;
    removeAttributeFilter: FilterContextReducer<{
        payload: IRemoveAttributeFilterPayload;
        type: string;
    }>;
    moveAttributeFilter: FilterContextReducer<{
        payload: IMoveAttributeFilterPayload;
        type: string;
    }>;
    addDateFilter: FilterContextReducer<{
        payload: IAddDateFilterPayload;
        type: string;
    }>;
    removeDateFilter: FilterContextReducer<{
        payload: IRemoveDateFilterPayload;
        type: string;
    }>;
    moveDateFilter: FilterContextReducer<{
        payload: IMoveDateFilterPayload;
        type: string;
    }>;
    updateAttributeFilterSelection: FilterContextReducer<{
        payload: IUpdateAttributeFilterSelectionPayload;
        type: string;
    }>;
    replaceAttributeFilterItem: FilterContextReducer<{
        payload: IReplaceAttributeFilterItemPayload;
        type: string;
    }>;
    setAttributeFilterParents: FilterContextReducer<{
        payload: ISetAttributeFilterParentsPayload;
        type: string;
    }>;
    setAttributeFilterDependentDateFilters: FilterContextReducer<{
        payload: ISetAttributeFilterDependentDateFiltersPayload;
        type: string;
    }>;
    clearAttributeFiltersSelection: FilterContextReducer<{
        payload: IClearAttributeFiltersSelectionPayload;
        type: string;
    }>;
    upsertDateFilter: FilterContextReducer<{
        payload: IUpsertDateFilterPayload;
        type: string;
    }>;
    changeAttributeDisplayForm: FilterContextReducer<{
        payload: IChangeAttributeDisplayFormPayload;
        type: string;
    }>;
    changeTextFilterDisplayForm: FilterContextReducer<{
        payload: IChangeTextFilterDisplayFormPayload;
        type: string;
    }>;
    changeAttributeTitle: FilterContextReducer<{
        payload: IChangeAttributeTitlePayload;
        type: string;
    }>;
    changeSelectionMode: FilterContextReducer<{
        payload: IChangeAttributeSelectionModePayload;
        type: string;
    }>;
    changeLimitingItems: FilterContextReducer<{
        payload: IChangeAttributeLimitingItemsPayload;
        type: string;
    }>;
    setPreloadedAttributesWithReferences: FilterContextReducer<{
        payload: IAttributeWithReferences[];
        type: string;
    }>;
    applyWorkingSelection: FilterContextReducer<{
        payload: IApplyWorkingSelectionPayload;
        type: string;
    }>;
    resetWorkingSelection: FilterContextReducer<{
        payload: void;
        type: string;
    }>;
    setDefaultFilterOverrides: FilterContextReducer<{
        payload: FilterContextItem[];
        type: string;
    }>;
    changeMeasureValueFilterCondition: FilterContextReducer<{
        payload: IChangeMeasureValueFilterConditionReducerPayload;
        type: string;
    }>;
    changeMeasureValueFilterTitle: FilterContextReducer<{
        payload: IChangeMeasureValueFilterTitleReducerPayload;
        type: string;
    }>;
};
export {};
//# sourceMappingURL=filterContextReducers.d.ts.map