import type { ItemBadge, REDOCLY_ROUTE_RBAC } from '@redocly/config';
import type { CollectionFieldSchema } from 'typesense/lib/Typesense/Collection';
import type { FacetCountsRequestParams, SearchRequestParams, SearchResponse } from '../../../types/index.js';
import type { ProductConfig } from '@redocly/theme/config';
import type { SearchFacet, SearchFacetCount, OperationParameter } from '@redocly/theme/core/types';
import type { ExportHandler } from 'flexsearch';
import type { AuthDetails } from '../../types';
import type { SEARCH_DOCUMENT_METADATA_KEY } from '../../constants/plugins/search';
export type SearchEngineType = 'flexsearch' | 'typesense';
export type SearchEngine = {
    addDocuments(documents: SearchDocument[], params: AddDocumentsParams): Promise<void>;
    search(params: SearchRequestParams, auth: AuthDetails): Promise<SearchResponse>;
    exportDocuments(outDir: string, facets: Map<string, SearchFacet>): Promise<void>;
    exportIndexes(outDir: string, facets: Map<string, SearchFacet>): Promise<void>;
    import(sourceDir: string): Promise<void>;
    countFacets(params: FacetCountsRequestParams, auth: AuthDetails, facets: Map<string, SearchFacet>): Record<string, SearchFacetCount[]> | object;
};
export type SearchDocumentMetadata = Partial<{
    includes: string[];
    excludes: string[];
    curated: boolean;
}>;
export type SearchParameters = {
    auth: AuthDetails;
    query: string;
    offset: number;
    groupFacetField?: string;
    product?: string;
    versions?: string[];
};
export type SearchIndex = {
    add(document: SearchDocument): void;
    search(params: SearchParameters): Promise<SearchResponse>;
    export(handler: ExportHandler<string | SearchDocument>): void;
    import(searchData: FlexSearchData): void;
    clearDocuments(): void;
};
export type AddDocumentsParams = {
    group: string;
    locale: string;
    outDir: string;
};
export type FlexSearchData = {
    documents: [number, SearchDocument][];
    index: Record<string, any>;
};
export type TypesenseSearchData = {
    documents: SearchDocument[];
    schemaFields: CollectionFieldSchema[];
};
export type AiSearchDocument = {
    url: string;
    fsPath: string;
    content: string;
    title: string;
    locale: string;
    product?: string;
    facets?: Record<string, string>;
};
export type SearchDocument = {
    id: string;
    url: string;
    title: string | string[];
    text: string | string[];
    path?: string[];
    httpMethod?: string;
    httpPath?: string | string[];
    deprecated?: boolean;
    security?: string[];
    parameters?: OperationParameter[];
    version?: string;
    versionFolderId?: string;
    isDefaultVersion?: boolean;
    isAdditionalOperation?: boolean;
    product?: ProductConfig;
    'redocly::teams-rbac'?: {
        [x: string]: string;
    };
    [REDOCLY_ROUTE_RBAC]?: {
        slug?: string;
        fsPath?: string;
    };
    badges?: ItemBadge[];
    facets?: Record<string, string>;
    tags?: string[];
    rbacTeams?: string[];
    [SEARCH_DOCUMENT_METADATA_KEY]?: SearchDocumentMetadata;
};
export type TypesenseSearchDocument = Omit<SearchDocument, typeof SEARCH_DOCUMENT_METADATA_KEY> & {
    metadata_curated?: boolean;
    metadata_keywords_includes?: string[];
    metadata_keywords_excludes?: string[];
};
//# sourceMappingURL=search.d.ts.map