"""
STRING_get_protein_interactions

Alternative method to retrieve protein interactions from STRING (Search Tool for Retrieval of Int...
"""

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


def STRING_get_protein_interactions(
    protein_ids: list[str],
    species: Optional[int] = 9606,
    confidence_score: Optional[float] = 0.4,
    limit: Optional[int] = 50,
    network_type: Optional[str] = "full",
    *,
    stream_callback: Optional[Callable[[str], None]] = None,
    use_cache: bool = False,
    validate: bool = True,
) -> dict[str, Any]:
    """
    Alternative method to retrieve protein interactions from STRING (Search Tool for Retrieval of Int...

    Parameters
    ----------
    protein_ids : list[str]
        List of protein identifiers (UniProt IDs, gene names, etc.)
    species : int
        NCBI taxonomy ID (default: 9606 for human)
    confidence_score : float
        Minimum confidence score (0-1, default: 0.4)
    limit : int
        Maximum number of interactions to return (default: 50)
    network_type : str
        Type of network ('full', 'physical', 'functional')
    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

    # Strip None values so optional parameters don't trigger schema validation errors
    _args = {
        k: v
        for k, v in {
            "protein_ids": protein_ids,
            "species": species,
            "confidence_score": confidence_score,
            "limit": limit,
            "network_type": network_type,
        }.items()
        if v is not None
    }
    return get_shared_client().run_one_function(
        {
            "name": "STRING_get_protein_interactions",
            "arguments": _args,
        },
        stream_callback=stream_callback,
        use_cache=use_cache,
        validate=validate,
    )


__all__ = ["STRING_get_protein_interactions"]
