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

from abc import ABC
from typing import Generic, Self, TYPE_CHECKING, TypeVar
from tree_sitter import Node as TSNode
from graph_sitter.core.detached_symbols.function_call import FunctionCall
from graph_sitter.core.expressions import Expression
from graph_sitter.core.interfaces.has_block import HasBlock
from graph_sitter.core.interfaces.importable import Importable
from graph_sitter.core.node_id_factory import NodeId
from graph_sitter.core.statements.statement import Statement
from graph_sitter.extensions.autocommit import reader
from graph_sitter.writer_decorators import apidoc, noapidoc
from graph_sitter.codebase.codebase_graph import CodebaseGraph
from graph_sitter.core.detached_symbols.code_block import CodeBlock

if TYPE_CHECKING:
    ...
TCodeBlock = TypeVar("TCodeBlock", bound="CodeBlock")
@apidoc
class WhileStatement(Statement[TCodeBlock], HasBlock, ABC, Generic[TCodeBlock]):
    """Abstract representation of the while statement block."""
    statement_type = ...
    condition: Expression[Self]
    code_block: TCodeBlock
    def __init__(self, ts_node: TSNode, file_node_id: NodeId, G: CodebaseGraph, parent: TCodeBlock, pos: int | None = ...) -> None:
        ...
    
    @property
    @reader
    def nested_code_blocks(self) -> list[TCodeBlock]:
        """Returns all nested CodeBlocks within the statement.

        Returns all code blocks that are nested within the while statement. For while statements,
        this will always be a list containing only the single code block associated with the
        while statement's body.

        Returns:
            list[TCodeBlock]: A list containing the code blocks associated with this while
                statement.
        """
        ...
    
    @property
    @reader
    def function_calls(self) -> list[FunctionCall]:
        """Returns all function calls within the while statement block.

        Collects all function calls from both the condition expression and the code block.

        Returns:
            list[FunctionCall]: A list of function calls found in the while statement's condition and code block.
        """
        ...
    
    @property
    @noapidoc
    def descendant_symbols(self) -> list[Importable]:
        ...
    


