import { buildContext, } from '../../../../controllers/commerce/context/headless-context.js';
import { MissingControllerProps } from '../../../common/errors.js';
import { createControllerWithKind, Kind } from '../../types/kind.js';
/**
 * Defines a `Context` controller instance.
 * @group Definers
 *
 * @returns The `Context` controller definition.
 */
export function defineContext() {
    return {
        listing: true,
        search: true,
        standalone: true,
        recommendation: true,
        buildWithProps: (engine, props) => {
            if (props === undefined) {
                throw new MissingControllerProps(Kind.Context);
            }
            const controller = buildContext(engine, { options: props });
            return createControllerWithKind(controller, Kind.Context);
        },
    };
}
