import { buildProductListing, } from '../../../../controllers/commerce/product-listing/headless-product-listing.js';
import { buildSearch, } from '../../../../controllers/commerce/search/headless-search.js';
import { SolutionType } from '../../types/controller-constants.js';
/**
 * Defines a `ProductList` controller instance.
 * @group Definers
 *
 * @param options - The configurable `ProductList` controller options.
 * @returns The `ProductList` controller definition.
 */
export function defineProductList(options = {}) {
    const { enableResults = false } = options;
    return {
        listing: true,
        search: true,
        build: (engine, solutionType) => solutionType === SolutionType.listing
            ? buildProductListing(engine, { enableResults })
            : buildSearch(engine, { enableResults }),
    };
}
