"""
This type stub file was generated by pyright.
"""

from abc import abstractmethod
from typing import Generic, TYPE_CHECKING, TypeVar
from tree_sitter import Node as TSNode
from typing_extensions import deprecated
from graph_sitter.core.autocommit import reader, writer
from graph_sitter.core.expressions import Expression
from graph_sitter.core.expressions.name import Name
from graph_sitter.core.interfaces.has_value import HasValue
from graph_sitter.core.interfaces.importable import Importable
from graph_sitter.core.interfaces.typeable import Typeable
from graph_sitter.core.interfaces.usable import Usable
from graph_sitter.core.symbol_groups.collection import Collection
from graph_sitter.writer_decorators import apidoc, noapidoc
from graph_sitter.core.expressions.type import Type
from graph_sitter.core.function import Function

if TYPE_CHECKING:
    ...
logger = ...
TType = TypeVar("TType", bound="Type")
Parent = TypeVar("Parent", bound="Collection[Parameter, Function]")
@apidoc
class Parameter(Usable[Parent], Typeable[TType, Parent], HasValue, Expression[Parent], Generic[TType, Parent]):
    """Abstract representation of a parameter in a Function definition."""
    _pos: int
    _name_node: Name | None = ...
    def __init__(self, ts_node: TSNode, index: int, parent: Parent) -> None:
        ...
    
    @property
    @reader
    def index(self) -> int:
        """Returns the 0-based index of this parameter within its parent function's parameter list.

        Args:
            None

        Returns:
            int: The position of the parameter in the function's parameter list, 0-based.
        """
        ...
    
    @deprecated("Use `type.edit` instead")
    @writer
    def set_type_annotation(self, type_annotation: str) -> None:
        """Sets the type annotation for this parameter.

        This method is deprecated in favor of `type.edit`.

        Args:
            type_annotation (str): The type annotation to set for the parameter.

        Returns:
            None
        """
        ...
    
    @property
    @reader
    def default(self) -> str | None:
        """Returns the default value of a parameter if one exists.

        Gets the default value of a parameter in a function definition. This is the value that would be used if the parameter is not provided in a function call.

        Args:
            None

        Returns:
            str | None: The string representation of the default value if one exists, None otherwise.
        """
        ...
    
    @property
    @abstractmethod
    def is_optional(self) -> bool:
        """Returns whether the parameter is optional in its function definition.

        A parameter is optional if either:
        1. It has a default value
        2. Its type annotation is Optional[T] or T | None
        3. It is variadic (*args, **kwargs)

        Returns:
            bool: True if the parameter is optional, False otherwise
        """
        ...
    
    @property
    @abstractmethod
    def is_variadic(self) -> bool:
        """Returns whether the parameter is a variadic parameter.

        A variadic parameter allows a function to accept a variable number of arguments (e.g., *args in Python).

        Returns:
            bool: True if the parameter is variadic (can accept variable number of arguments),
                False otherwise.
        """
        ...
    
    @writer
    def remove(self, delete_formatting: bool = ..., priority: int = ..., dedupe: bool = ...) -> None:
        """Removes the parameter from the function definition and all its call sites.

        Removes the parameter from a function's definition and also removes the corresponding argument
        from all call sites of the function. If an argument cannot be found at a call site, logs a message
        and continues with other call sites.

        Args:
            delete_formatting (bool, optional): Whether to delete formatting around the parameter. Defaults to True.
            priority (int, optional): Priority level for the removal operation. Defaults to 0.
            dedupe (bool, optional): Whether to deduplicate removal operations. Defaults to True.

        Returns:
            None
        """
        ...
    
    @writer
    def rename(self, new_name: str, priority: int = ...) -> None:
        """Renames a parameter in a function definition and updates all related references.

        Performs a comprehensive rename operation by updating the parameter name in the function definition,
        all variable usages within the function body, and any keyword arguments in call sites.

        Args:
            new_name (str): The new name for the parameter.
            priority (int, optional): The priority of the edit operation. Defaults to 0.

        Returns:
            None
        """
        ...
    
    @property
    @noapidoc
    def descendant_symbols(self) -> list[Importable]:
        ...
    


