"""Abstract base classes for search indices."""

from abc import ABC, abstractmethod
from typing import Literal

from .types import SearchResult


class SearchIndex(ABC):
    """Abstract base class for search index implementations."""

    @abstractmethod
    def build_index(
        self,
        records: list[dict],
        deduplicate_strategy: Literal["exact", "fuzzy", None],
        deduplicate_by: str | None = None,
    ):
        raise NotImplementedError

    @abstractmethod
    def search(
        self, queries: list[str], fields: list[str], limit: int = 8, escape: bool = True
    ) -> list[SearchResult]:
        raise NotImplementedError
