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

from functools import cached_property
from graph_sitter.core.autocommit import reader, writer
from graph_sitter.core.expressions.chained_attribute import ChainedAttribute
from graph_sitter.core.expressions.defined_name import DefinedName
from graph_sitter.core.expressions.name import Name
from graph_sitter.writer_decorators import apidoc

@apidoc
class HasName:
    """An interface for any node object that has a name."""
    _name_node: Name | ChainedAttribute | DefinedName | None = ...
    @cached_property
    @reader
    def name(self) -> str | None:
        """Retrieves the base name of the object without namespace prefixes.

        Returns:
            str | None: The base name of the object, or None if no name node is associated.
        """
        ...
    
    @cached_property
    @reader
    def full_name(self) -> str | None:
        """Returns the full name of the object, including the namespace path.

        For class methods, this returns the parent class's full name followed by the method name. For chained attributes (e.g., 'a.b'), this returns the full chained name.

        Returns:
            str | None: The complete qualified name of the object. Returns None if no name is available.
        """
        ...
    
    @reader
    def get_name(self) -> Name | ChainedAttribute | None:
        """Returns the name node of the object.

        Args:
            None

        Returns:
            Name | ChainedAttribute | None: The name node of the object. Can be a Name node for simple names,
            a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name.
        """
        ...
    
    @writer
    def set_name(self, name: str) -> None:
        """Sets the name of a code element.

        Modifies the name of the object's underlying name node. Works with both simple names and chained attributes (e.g., 'a.b').

        Args:
            name (str): The new name to set for the object.

        Returns:
            None
        """
        ...
    
    @writer
    def rename(self, name: str) -> None:
        """Sets the name of an object and updates all its usages.

        Args:
            name (str): The new name to assign to the object.

        Returns:
            None
        """
        ...
    


