import type { Result } from '../../api/search/search/result.js'; import type { CoreEngine, CoreEngineNext } from '../../app/engine.js'; import { type Template, type TemplateCondition } from '../templates/templates-manager.js'; export type ResultTemplate = Template; export type ResultTemplateCondition = TemplateCondition; export interface ResultTemplatesManager { /** * Registers any number of result templates in the manager. * @param templates (...ResultTemplate) A list of templates to register. */ registerTemplates(...newTemplates: ResultTemplate[]): void; /** * Selects the highest priority template for which the given result satisfies all conditions. * In the case where satisfied templates have equal priority, the template that was registered first is returned. * @param result (Result) The result for which to select a template. * @returns (Content) The selected template's content, or null if no template's conditions are satisfied. */ selectTemplate(result: Result): Content | null; /** * Selects the highest priority link template for which the given result satisfies all conditions. * In the case where satisfied templates have equal priority, the template that was registered first is returned. * @param result (Result) The result for which to select a template. * @returns (Content) The selected template's content, or null if no template's conditions are satisfied. */ selectLinkTemplate(result: Result): LinkContent | null; } /** * A manager in which result templates can be registered and selected based on a list of conditions and priority. * @param engine (HeadlessEngine) The `HeadlessEngine` instance of your application. * @returns (ResultTemplatesManager) A new result templates manager. */ export declare function buildResultTemplatesManager(engine: CoreEngine | CoreEngineNext): ResultTemplatesManager;