import { createControllerWithKind, Kind, } from '../../../app/commerce-ssr-engine/types/kind.js';
import { MissingControllerProps } from '../../../utils/errors.js';
import { buildContext, } from './headless-context.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);
        },
    };
}
