import { type SchemaDefinition } from '@coveo/bueno';
import { type UnknownAction } from '@reduxjs/toolkit';
import type { CommerceEngine } from '../../../../app/commerce-engine/commerce-engine.js';
import { stateKey } from '../../../../app/state-key.js';
import type { Parameters } from '../../../../features/commerce/parameters/parameters-actions.js';
import { type Controller } from '../../../controller/headless-controller.js';
import type { FetchProductsActionCreator } from '../common.js';
export interface ParameterManagerProps<T extends Parameters> {
    /**
     * The initial state that should be applied to the `ParameterManager` sub-controller.
     */
    initialState?: ParameterManagerInitialState<T>;
    /**
     * Whether the controller's state should exclude the default parameters returned by the Commerce API, and only include
     * the parameters that were set explicitly set through dispatched actions.
     *
     * Defaults to `false`.
     */
    excludeDefaultParameters?: boolean;
}
export interface CoreParameterManagerProps<T extends Parameters> extends ParameterManagerProps<T> {
    /**
     * The definition of the parameters.
     */
    parametersDefinition: SchemaDefinition<Required<T>>;
    /**
     * The selector to retrieve the active parameters from the state.
     */
    activeParametersSelector: (state: CommerceEngine[typeof stateKey]) => T;
    /**
     * The action to dispatch to update the parameters in the state.
     */
    restoreActionCreator: (parameters: T) => UnknownAction;
    /**
     * The action to dispatch to fetch more results.
     */
    fetchProductsActionCreator: FetchProductsActionCreator;
}
export interface ParameterManagerInitialState<T> {
    /**
     * The parameters affecting the response.
     */
    parameters: T;
}
/**
 * The `ParameterManager` sub-controller allows restoring parameters that affect the results (e.g., from the URL).
 *
 * @group Sub-controllers
 * @category ParameterManager
 */
export interface ParameterManager<T extends Parameters> extends Controller {
    /**
     * Updates the parameters in the state with the specified parameters and fetches results. Unspecified keys are reset to their initial values.
     *
     * @param parameters - The parameters to synchronize.
     */
    synchronize(parameters: T): void;
    /**
     * The state relevant to the `ParameterManager` sub-controller.
     */
    state: ParameterManagerState<T>;
}
/**
 * The state of the `ParameterManager` sub-controller.
 *
 * @group Sub-controllers
 * @category ParameterManager
 */
export interface ParameterManagerState<T extends Parameters> {
    /**
     * The parameters affecting the response.
     */
    parameters: T;
}
/**
 * @internal
 * Creates a `ParameterManager` sub-controller instance.
 *
 * @param engine - The headless commerce engine.
 * @param props - The configurable `ParameterManager` properties.
 * @returns A `ParameterManager` sub-controller instance.
 */
export declare function buildCoreParameterManager<T extends Parameters>(engine: CommerceEngine, props: CoreParameterManagerProps<T>): ParameterManager<T>;
