"""
ChEMBL_search_similarity

Search molecules similar to a given SMILES string using Tanimoto similarity. Returns molecules wi...
"""

from typing import Any, Optional, Callable
from ._shared_client import get_shared_client


def ChEMBL_search_similarity(
    smiles: str,
    threshold: int,
    limit: Optional[int] = 20,
    offset: Optional[int] = 0,
    *,
    stream_callback: Optional[Callable[[str], None]] = None,
    use_cache: bool = False,
    validate: bool = True,
) -> dict[str, Any]:
    """
    Search molecules similar to a given SMILES string using Tanimoto similarity. Returns molecules wi...

    Parameters
    ----------
    smiles : str
        SMILES string to search for similar molecules
    threshold : int
        Similarity threshold (0-100). Molecules with similarity >= threshold will be ...
    limit : int
        Maximum number of results (default: 20, max: 1000)
    offset : int
        Offset for pagination (default: 0)
    stream_callback : Callable, optional
        Callback for streaming output
    use_cache : bool, default False
        Enable caching
    validate : bool, default True
        Validate parameters

    Returns
    -------
    dict[str, Any]
    """
    # Handle mutable defaults to avoid B006 linting error

    return get_shared_client().run_one_function(
        {
            "name": "ChEMBL_search_similarity",
            "arguments": {
                "smiles": smiles,
                "threshold": threshold,
                "limit": limit,
                "offset": offset,
            },
        },
        stream_callback=stream_callback,
        use_cache=use_cache,
        validate=validate,
    )


__all__ = ["ChEMBL_search_similarity"]
