import type { SearchFilterItem } from '@redocly/theme/core/types';
import type { SSE_EVENTS } from '../constants/ai-search';
import type { AiSearchError } from '@redocly/theme/core/constants';
export type SSEMessageType = (typeof SSE_EVENTS)[keyof typeof SSE_EVENTS];
export type SearchResource = {
    url: string;
    title: string;
};
export type DocumentSource = SearchResource & {
    id: string;
};
export type SSEMessageId = {
    type: typeof SSE_EVENTS.MESSAGE_ID;
    messageId: string;
};
export type SSESources = {
    type: typeof SSE_EVENTS.SOURCES;
    sources: DocumentSource[];
};
export type SSEAnswer = {
    type: typeof SSE_EVENTS.ANSWER;
    answer: string;
};
export type SSEToolCall = {
    type: typeof SSE_EVENTS.TOOL_CALL;
    toolCall: {
        id: string;
        name: string;
        args: unknown;
    };
};
export type SSEToolResult = {
    type: typeof SSE_EVENTS.TOOL_RESULT;
    toolName: string;
    args: unknown;
    result: {
        toolCallId: string;
        documentCount?: number;
    };
};
export type SSEError = {
    type: typeof SSE_EVENTS.ERROR;
    error: {
        message: string;
    };
};
export type SSEMessage = SSEMessageId | SSESources | SSEAnswer | SSEToolCall | SSEToolResult | SSEError;
export type ToolCallState = {
    id: string;
    name: string;
    args: unknown;
    position: number;
    result?: {
        toolCallId: string;
        documentCount?: number;
    };
};
export type AiSearchOptions = {
    filter?: SearchFilterItem[];
    product?: string;
};
export type AiSearchState = {
    status: 'idle';
    response?: string;
} | {
    status: 'loading';
    question: string;
    response: string;
    resources: SearchResource[];
} | {
    status: 'success';
    question: string;
    response: string;
    resources: SearchResource[];
} | {
    status: 'error';
    question: string;
    error: AiSearchError;
};
//# sourceMappingURL=ai-search.d.ts.map