import type { Result } from '../../../api/search/search/result.js'; import type { InsightEngine } from '../../../app/insight-engine/insight-engine.js'; import type { AttachedResult } from '../../../features/attached-results/attached-results-state.js'; import { type Controller } from '../../controller/headless-controller.js'; export interface AttachedResultsProps { /** * The options for the `AttachedResults` controller. */ options: AttachedResultsOptions; } export interface AttachedResultsOptions { /** * The Id of the case to attach to. */ caseId: string; } export interface AttachedResultsState { /** * The list of attached results for the specified case. */ results: AttachedResult[]; /** * Whether the attached results are currently being loaded. */ loading: boolean; } /** * The AttachedResults controller manages all attached results for a given case. * It provides a unified API to attach/detach results, check attachment status, * and access all attached results for the case. * * @group Controllers * @category AttachedResults */ export interface AttachedResults extends Controller { /** * Check if a specific result is attached to this case. * @param result - The result to check if attached, with SearchAPI fields such as permanentId or uriHash. * @returns A boolean indicating if the result is attached. */ isAttached(result: Result): boolean; /** * Attach a new result by adding it to the attachedResults state. * @param result - A result to add to the list of currently attached results. */ attach(result: Result): void; /** * Detach a result by removing it from the attachedResults state. * @param result - A result to remove from the list of currently attached results. */ detach(result: Result): void; /** * The state of the `AttachedResults` controller. * Returns all attached results for this case. */ state: AttachedResultsState; } /** * Creates an AttachedResults controller instance. * * @param engine - The headless engine. * @param props - The configurable `AttachedResults` properties. * @returns A `AttachedResults` controller instance. * * @group Controllers * @category AttachedResults */ export declare function buildAttachedResults(engine: InsightEngine, props: AttachedResultsProps): AttachedResults;