import { CommerceAPIErrorStatusResponse } from '../../../api/commerce/commerce-api-error-response.js';
import { ChildProduct, Product } from '../../../api/commerce/common/product.js';
import { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
import { Controller } from '../../controller/headless-controller.js';
import { SearchSubControllers } from '../core/sub-controller/headless-sub-controller.js';
/**
 * The `Search` controller lets you create a commerce search page.
 *
 * Example: [search.fn.tsx](https://github.com/coveo/ui-kit/blob/master/packages/samples/headless-react/src/components/commerce/search.fn.tsx)
 *
 * @group Buildable controllers
 * @category Search
 */
export interface Search extends Controller, SearchSubControllers {
    /**
     * Executes the first search.
     */
    executeFirstSearch(): void;
    /**
     * Finds the specified parent product and the specified child product of that parent, and makes that child the new
     * parent. The `children` and `totalNumberOfChildren` properties of the original parent are preserved in the new
     * parent.
     *
     * This method is useful when leveraging the product grouping feature to allow users to select nested products.
     *
     * E.g., if a product has children (such as color variations), you can call this method when the user selects a child
     * to make that child the new parent product, and re-render the product as such in the storefront.
     *
     * **Note:** In the controller state, a product that has children will always include itself as its own child so that
     * it can be rendered as a nested product, and restored as the parent product through this method as needed.
     *
     * @param child The child product that will become the new parent.
     */
    promoteChildToParent(child: ChildProduct): void;
    /**
     * A scoped and simplified part of the headless state that is relevant to the `Search` controller.
     */
    state: SearchState;
}
/**
 * @group Buildable controllers
 * @category Search
 */
export interface SearchState {
    products: Product[];
    error: CommerceAPIErrorStatusResponse | null;
    isLoading: boolean;
    responseId: string;
}
/**
 * Builds a `Search` controller for the given commerce engine.
 * @param engine - The commerce engine.
 * @returns A `Search` controller.
 *
 * @group Buildable controllers
 * @category Search
 */
export declare function buildSearch(engine: CommerceEngine): Search;
