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

from typing import Generic, Self, TYPE_CHECKING, TypeVar
from tree_sitter import Node as TSNode
from graph_sitter._proxy import proxy_property
from graph_sitter.codebase.codebase_graph import CodebaseGraph
from graph_sitter.core.autocommit import writer
from graph_sitter.core.expressions import Expression
from graph_sitter.core.interfaces.editable import Editable
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.node_id_factory import NodeId
from graph_sitter.core.statements.statement import Statement
from graph_sitter.core.symbol import Symbol
from graph_sitter.extensions.autocommit import reader
from graph_sitter.writer_decorators import apidoc, noapidoc
from graph_sitter.core.expressions.type import Type
from graph_sitter.core.statements.assignment_statement import AssignmentStatement
from graph_sitter.core.statements.export_statement import ExportStatement

if TYPE_CHECKING:
    ...
Parent = TypeVar("Parent", bound="AssignmentStatement | ExportStatement")
@apidoc
class Assignment(Symbol[Parent, ...], Typeable[Parent, ...], HasValue, Generic[Parent]):
    """Represents an assignment for a single variable within an assignment statement.

    Attributes:
        left: The left side of the assignment
        right: The right side of the assignment

    Example:
        ```typescript
        var z
        var z = 5
        ```
    """
    _left: Expression[Self]
    symbol_type = ...
    def __init__(self, ts_node: TSNode, file_node_id: NodeId, G: CodebaseGraph, parent: Parent, left: TSNode, value: TSNode, name_node: TSNode, type: Type | None = ...) -> None:
        ...
    
    @property
    @noapidoc
    @reader
    def left(self) -> Expression[Self]:
        """The left side of the assignment.

        Only should be used for internal purposes.
        """
        ...
    
    @property
    @reader
    def index(self) -> int:
        """Returns the index of the assignment statement in its parent's code block.

        Returns:
            int: The 0-based index position of the assignment statement within its parent's code block statements.
        """
        ...
    
    @property
    @reader
    def is_local_variable(self) -> bool:
        """Determines if an assignment represents a local variable in the current scope.

        A local variable is an assignment that:
        1. Is not a chained attribute (e.g., not self.x or obj.x)
        2. Is not in the global (file) scope

        Returns:
            bool: True if the assignment is a local variable, False otherwise.
        """
        ...
    
    @proxy_property
    @reader
    def local_usages(self) -> list[Editable[Statement]]:
        """Retrieves all usages of the assigned variable within its code block scope.

        Returns all instances where the variable defined in this Assignment is used within its code block. Only returns usages that occur after the assignment, excluding the usage in the assignment
        itself.

        Returns:
            list[Editable[Statement]]: A sorted list of statement nodes where the variable is used.

        Note:
            This method can be called as both a property or a method. If used as a property, it is equivalent to invoking it without arguments.
        """
        ...
    
    @writer
    def set_value(self, src: str) -> None:
        """Sets the value of an assignment expression.

        Updates the value of an assignment expression. If the assignment doesn't have an existing value,
        it adds one after the type annotation (if present) or after the variable name. If the assignment
        already has a value, it replaces the existing value.

        Args:
            src (str): The source code string representing the new value to be assigned.

        Returns:
            None
        """
        ...
    
    @writer
    def set_type_annotation(self, type_str: str) -> None:
        """Adds or updates a type annotation for the current assignment.

        This method modifies an assignment statement to include a type annotation. If the assignment already
        has a type annotation, it will be overwritten with the new type. If no type annotation exists,
        one will be added between the assignment name and the equals sign.

        Args:
            type_str (str): The type annotation to be added or updated.

        Returns:
            None
        """
        ...
    
    @property
    @noapidoc
    def descendant_symbols(self) -> list[Importable]:
        ...
    
    def __hash__(self) -> int:
        ...
    
    @reader
    def __eq__(self, other: object) -> bool:
        ...
    
    @writer
    def reduce_condition(self, bool_condition: bool, node: Editable | None = ...) -> None:
        """Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages.


        Args:
            bool_condition (bool): The boolean value to reduce the condition to.

        """
        ...
    


