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

from collections.abc import Collection, Iterator
from typing import Generic, TYPE_CHECKING, TypeVar
from tree_sitter import Node as TSNode
from graph_sitter.core.autocommit import reader, repr_func, writer
from graph_sitter.core.interfaces.editable import Editable
from graph_sitter.core.node_id_factory import NodeId
from graph_sitter.writer_decorators import apidoc
from graph_sitter.codebase.codebase_graph import CodebaseGraph

if TYPE_CHECKING:
    ...
Child = TypeVar("Child", bound="Editable")
Parent = TypeVar("Parent", bound="Parent")
@apidoc
class SymbolGroup(Editable[Parent], Collection[Child], Generic[Child, Parent]):
    """These are groups of symbols that form some kind of logical grouping, like a class or module,
    that do not follow the traditional tree structure.
    """
    _symbols: list[Child]
    def __init__(self, file_node_id: NodeId, G: CodebaseGraph, parent: Parent, node: TSNode | None = ..., children: list[Child] | None = ...) -> None:
        ...
    
    @repr_func
    def __hash__(self) -> int:
        ...
    
    def __eq__(self, other: object) -> bool:
        ...
    
    @property
    @reader
    def symbols(self) -> list[Child]:
        """Returns the list of symbols in the group.

        Gets the list of symbols associated with this SymbolGroup. These symbols can be code elements like functions, classes, or variables that form a logical grouping.

        Returns:
            list[Child]: A list of symbol objects that belong to this group.
        """
        ...
    
    @property
    @reader
    def source(self) -> str:
        """Returns the concatenated source code of all symbols in the group.

        Returns:
            str: The concatenated source code of all symbols in the group.
        """
        ...
    
    @source.setter
    @writer
    def source(self, value) -> None:
        """Sets the source code of the Editable instance.

        Updates the source code by calling the edit method with the provided value.

        Args:
            value (str): The new source code to set for this Editable instance.

        Returns:
            None
        """
        ...
    
    @property
    @reader
    def next_sibling(self) -> Editable | None:
        """Returns the next sibling of the last symbol in the symbol group.

        Provides access to the next sibling node of the last symbol in this symbol group.

        Returns:
            Editable | None: The next sibling node of the last symbol in the group, or None if there is no next sibling.
        """
        ...
    
    @property
    @reader
    def next_named_sibling(self) -> Editable | None:
        """Returns the next named sibling of the last symbol in the group.

        Args:
            None

        Returns:
            Editable | None: The next named sibling node, or None if there is no next named sibling.
        """
        ...
    
    @writer
    def find_string_literals(self, strings_to_match: list[str], fuzzy_match: bool = ...) -> list[Editable]:
        """Search for string literals matching given strings in the SymbolGroup.

        Iterates through all symbols in the group and aggregates the results of
        finding string literals in each symbol.

        Args:
            strings_to_match (list[str]): List of strings to search for in string literals.
            fuzzy_match (bool, optional): If True, performs fuzzy matching instead of exact matching.

        Returns:
            list[Editable]: List of Editable nodes representing the matching string literals found within the symbols.
        """
        ...
    
    @writer
    def replace(self, old: str, new: str, count: int = ..., priority: int = ...) -> int:
        """Replaces all instances of a string with a new string in all symbols within the group.

        Args:
            old (str): The string to be replaced.
            new (str): The string to replace with.
            count (int, optional): Maximum number of replacements to make. Defaults to -1 (replace all).
            priority (int, optional): Priority of the replacement operation. Defaults to 0.

        Returns:
            int: Number of replacements made.
        """
        ...
    
    @reader
    def find(self, strings_to_match: list[str] | str, *, exact: bool = ...) -> list[Editable]:
        """Search for substrings in the given symbols that match `strings_to_match`.

        Args:
            strings_to_match (list[str] | str): The string or list of strings to search for.
            exact (bool): If True, only return nodes that exactly match the query.

        Returns:
            list[Editable]: A list of Editable objects representing each match found.
        """
        ...
    
    @reader
    def search(self, regex_pattern: str, include_strings: bool = ..., include_comments: bool = ...) -> list[Editable]:
        """Searches for regex matches in the codebase.

        Searches through the source code to find text matching a regex pattern, with options to exclude string literals and comments from the search.

        Args:
            regex_pattern (str): The regular expression pattern to search for.
            include_strings (bool, optional): Whether to include string literals in the search. Defaults to True.
            include_comments (bool, optional): Whether to include comments in the search. Defaults to True.

        Returns:
            list[Editable]: A list of Editable objects representing matched text nodes in the codebase.
        """
        ...
    
    @writer
    def insert_before(self, new_src: str, fix_indentation: bool = ..., newline: bool = ..., priority: int = ..., dedupe: bool = ...) -> None:
        """Inserts source code before this symbol group.

        Inserts the provided source code before the first symbol in the group, while maintaining proper code formatting.

        Args:
            new_src (str): The source code to insert.
            fix_indentation (bool, optional): Whether to adjust the indentation of the inserted code to match the current code. Defaults to False.
            newline (bool, optional): Whether to add a newline after the inserted code. Defaults to True.
            priority (int, optional): The priority of this edit operation. Higher priority edits are applied first. Defaults to 0.
            dedupe (bool, optional): Whether to prevent duplicate insertions of the same code. Defaults to True.

        Returns:
            None
        """
        ...
    
    @writer
    def insert_after(self, new_src: str, fix_indentation: bool = ..., newline: bool = ..., priority: int = ..., dedupe: bool = ...) -> None:
        """Inserts source code after this node in the codebase.

        Args:
            new_src (str): The source code to insert.
            fix_indentation (bool, optional): Adjust indentation to match current text.
            newline (bool, optional): Add a newline before the inserted code.
            priority (int, optional): Priority of the edit operation.
            dedupe (bool, optional): Deduplicate identical edits.

        Returns:
            None
        """
        ...
    
    @writer
    def edit(self, new_src: str, fix_indentation: bool = ..., priority: int = ..., dedupe: bool = ...) -> None:
        """Replace the source of this node with new text.

        Replaces the source of this SymbolGroup with new text by replacing the first symbol's source and removing all other symbols.

        Args:
            new_src (str): The new source text to replace the current text with.
            fix_indentation (bool, optional): Adjusts the indentation of new_src to match the current text's indentation. Defaults to False.
            priority (int, optional): Priority of the edit operation. Higher priority edits take precedence. Defaults to 0.
            dedupe (bool, optional): Prevents duplicate edits at the same location. Defaults to True.

        Returns:
            None
        """
        ...
    
    @writer
    def remove(self, delete_formatting: bool = ..., priority: int = ..., dedupe: bool = ...) -> None:
        """Removes this node and its related extended nodes from the codebase.

        Args:
            delete_formatting (bool, optional): Whether to delete related extended nodes like decorators and comments. Defaults to True.
            priority (int, optional): Priority level of the removal operation. Defaults to 0.
            dedupe (bool, optional): Whether to deduplicate removal operations. Defaults to True.

        Returns:
            None
        """
        ...
    
    @reader
    def __iter__(self) -> Iterator[Child]:
        ...
    
    @reader
    def __contains__(self, __x) -> bool:
        ...
    
    @reader
    def __len__(self) -> int:
        ...
    
    @reader
    def __getitem__(self, item):
        ...
    
    def __bool__(self) -> bool:
        ...
    


