import type { CommerceEngine } from '../../../../../app/commerce-engine/commerce-engine.js';
import type { FacetType } from '../../../../../features/commerce/facets/facet-set/interfaces/common.js';
import type { AnyFacetValueResponse } from '../../../../../features/commerce/facets/facet-set/interfaces/response.js';
import type { AnyFacetValueRequest } from '../../../../../features/facets/generic/interfaces/generic-facet-request.js';
import { type Controller } from '../../../../controller/headless-controller.js';
import type { FetchProductsActionCreator } from '../../common.js';
import type { CategoryFacet } from '../category/headless-commerce-category-facet.js';
import type { DateFacet } from '../date/headless-commerce-date-facet.js';
import type { CommerceFacetOptions, CoreCommerceFacet } from '../headless-core-commerce-facet.js';
import type { LocationFacet } from '../location/headless-commerce-location-facet.js';
import type { NumericFacet } from '../numeric/headless-commerce-numeric-facet.js';
import type { RegularFacet } from '../regular/headless-commerce-regular-facet.js';
import type { SearchableFacetOptions } from '../searchable/headless-commerce-searchable-facet.js';
/**
 * The `FacetGenerator` headless sub-controller creates commerce facet sub-controllers from the Commerce API search or
 * product listing response.
 *
 * Commerce facets are not requested by the implementer, but rather pre-configured through the Coveo Merchandising Hub
 * (CMH). The implementer is only responsible for leveraging the facet controllers created by this sub-controller to
 * properly render facets in their application.
 *
 * @group Sub-controllers
 * @category FacetGenerator
 */
export interface FacetGenerator extends Controller {
    /**
     * The ordered list of facet IDs for which sub-controllers will be created and returned when the `facets` getter is called.
     */
    state: string[];
    /**
     * The facet sub-controllers created by the facet generator.
     * Array of [RegularFacet](./regular-facet), [DateRangeFacet](./date-range-facet), [NumericFacet](./numeric-facet), [CategoryFacet](./category-facet), and [LocationFacet](./location-facet).
     */
    facets: GeneratedFacetControllers;
    /**
     * Deselects all values in all facets.
     * */
    deselectAll(): void;
}
/**
 * Represents the state of a facet generator.
 *
 * @group Sub-controllers
 * @category FacetGenerator
 */
export type FacetGeneratorState = FacetGenerator['state'];
/**
 * Represents an array of generated facet sub-controllers.
 * Each sub-controller is mapped to a specific facet type.
 */
export type GeneratedFacetControllers = Array<MappedGeneratedFacetController[FacetType]>;
export type MappedGeneratedFacetController = {
    [T in FacetType]: T extends 'numericalRange' ? NumericFacet : T extends 'regular' ? RegularFacet : T extends 'dateRange' ? DateFacet : T extends 'hierarchical' ? CategoryFacet : T extends 'location' ? LocationFacet : never;
};
type CommerceFacetBuilder<Facet extends Omit<CoreCommerceFacet<AnyFacetValueRequest, AnyFacetValueResponse>, 'isValueExcluded' | 'toggleExclude' | 'toggleSingleExclude' | 'toggleSingleSelect'>> = (engine: CommerceEngine, options: CommerceFacetOptions) => Facet;
export type CommerceSearchableFacetBuilder<Facet extends CoreCommerceFacet<AnyFacetValueRequest, AnyFacetValueResponse>> = (engine: CommerceEngine, options: CommerceFacetOptions & SearchableFacetOptions) => Facet;
/**
 * @internal
 *
 * The `FacetGenerator` options used internally.
 */
export interface FacetGeneratorOptions {
    buildRegularFacet: CommerceFacetBuilder<RegularFacet>;
    buildNumericFacet: CommerceFacetBuilder<NumericFacet>;
    buildDateFacet: CommerceFacetBuilder<DateFacet>;
    buildCategoryFacet: CommerceFacetBuilder<CategoryFacet>;
    buildLocationFacet: CommerceFacetBuilder<LocationFacet>;
    fetchProductsActionCreator: FetchProductsActionCreator;
}
/**
 * @internal
 *
 * Creates a `FacetGenerator` sub-controller.
 *
 * @param engine - The commerce engine.
 * @param options - The facet generator options used internally.
 * @returns A `FacetGenerator` sub-controller.
 */
export declare function buildFacetGenerator(engine: CommerceEngine, options: FacetGeneratorOptions): FacetGenerator;
export {};
