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

from typing import TYPE_CHECKING
from tree_sitter import Node as TSNode
from graph_sitter.core.autocommit import reader
from graph_sitter.core.autocommit.decorators import writer
from graph_sitter.core.detached_symbols.parameter import Parameter
from graph_sitter.core.placeholder.placeholder import Placeholder
from graph_sitter.core.symbol_groups.collection import Collection
from graph_sitter.typescript.expressions.type import TSType
from graph_sitter.writer_decorators import ts_apidoc
from graph_sitter.typescript.function import TSFunction

if TYPE_CHECKING:
    ...
@ts_apidoc
class TSParameter(Parameter[TSType, Collection["TSParameter", "TSFunction"]]):
    """A class representing a TypeScript function parameter with extensive type analysis capabilities.

    This class provides functionality to inspect and manipulate TypeScript function parameters,
    including support for destructured parameters, optional parameters, variadic parameters,
    default values, and type annotations.

    Attributes:
        type (TSType): The TypeScript type annotation of the parameter.
    """
    def __init__(self, ts_node: TSNode, index: int, parent: TSFunction, type: TSType | Placeholder | None = ...) -> None:
        ...
    
    @property
    @reader
    def is_destructured(self) -> bool:
        """Determines if a parameter is part of an object destructuring pattern.

        Checks the parameter's tree-sitter node type to determine if it represents a destructured parameter.
        A parameter is considered destructured if it appears within an object destructuring pattern.

        Returns:
            bool: True if the parameter is destructured, False otherwise.
        """
        ...
    
    @property
    @reader
    def is_optional(self) -> bool:
        """Determines if a parameter is marked as optional in TypeScript.

        Checks whether a parameter is marked with the '?' syntax in TypeScript, indicating that it is optional.
        If the parameter is part of a destructured pattern, this function returns False as optionality is
        handled at the function level for destructured parameters.

        Returns:
            bool: True if the parameter is marked as optional, False otherwise.
        """
        ...
    
    @property
    @reader
    def is_variadic(self) -> bool:
        """Determines if a parameter is variadic (using the rest operator).

        A property that checks if the parameter uses the rest pattern (e.g., ...args in TypeScript),
        which allows the parameter to accept an arbitrary number of arguments.

        Returns:
            bool: True if the parameter is variadic (uses rest pattern), False otherwise.
        """
        ...
    
    @property
    @reader
    def default(self) -> str | None:
        """Returns the default value of a parameter.

        Retrieves the default value of a parameter, handling both destructured and non-destructured parameters.
        For destructured parameters, returns the default value if it's an object assignment pattern.
        For non-destructured parameters, returns the value specified after the '=' sign.

        Returns:
            str | None: The default value of the parameter as a string if it exists, None otherwise.
        """
        ...
    
    @writer
    def convert_to_interface(self) -> None:
        """Converts a parameter's inline type definition to an interface.

        For React components, converts inline props type definitions to a separate interface.
        Handles both simple types and complex types including generics, extends patterns, and union types.
        The interface will be named {ComponentName}Props and inserted before the component.
        Supports extracting types from destructured parameters and preserves any type parameters.

        Example:
            ```typescript
            // Before
            function Button(props: { text: string, onClick: () => void }) {
                return <button>{props.text}</button>;
            }

            // After
            interface ButtonProps {
                text: string;
                onClick: () => void;
            }
            function Button(props: ButtonProps) {
                return <button>{props.text}</button>;
            }
            ```
        """
        ...
    


