import { ensureAtLeastOneSolutionType } from '../../../../app/commerce-ssr-engine/common.js';
import { SolutionType, } from '../../../../app/commerce-ssr-engine/types/common.js';
import { buildProductListing } from '../../product-listing/headless-product-listing.js';
import { buildSearch } from '../../search/headless-search.js';
/**
 * Defines a `Pagination` controller instance.
 * @group Definers
 *
 * @param props - The configurable `Pagination` properties.
 * @returns The `Pagination` controller definition.
 */
export function definePagination(props) {
    ensureAtLeastOneSolutionType(props);
    return {
        listing: true,
        search: true,
        ...props,
        build: (engine, solutionType) => solutionType === SolutionType.listing
            ? buildProductListing(engine).pagination(props)
            : buildSearch(engine).pagination(props),
    };
}
