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

from typing import Literal, TYPE_CHECKING
from tree_sitter import Node as TSNode
from graph_sitter.codebase.codebase_graph import CodebaseGraph
from graph_sitter.core.autocommit import commiter, reader
from graph_sitter.core.expressions.name import Name
from graph_sitter.core.interfaces.callable import Callable
from graph_sitter.core.interfaces.has_attribute import HasAttribute
from graph_sitter.core.node_id_factory import NodeId
from graph_sitter.enums import ImportType, NodeType
from graph_sitter.writer_decorators import apidoc, noapidoc
from graph_visualization.enums import VizNode
from graph_sitter.core.detached_symbols.parameter import Parameter
from graph_sitter.core.import_resolution import Import

if TYPE_CHECKING:
    ...
@apidoc
class ExternalModule(Callable, HasAttribute["ExternalModule"]):
    """Represents an external module, like `datetime`, that can be referenced.

    These are only added to the graph during import resolution and will not exist in a local file's
    subgraph. This is because we don't know what an import is referencing or resolves to until we
    see the full codebase.
    """
    node_type: Literal[NodeType.EXTERNAL] = ...
    def __init__(self, ts_node: TSNode, file_node_id: NodeId, G: CodebaseGraph, import_name: Name) -> None:
        ...
    
    @noapidoc
    @commiter
    def parse(self, G: CodebaseGraph) -> None:
        ...
    
    @classmethod
    def from_import(cls, imp: Import) -> ExternalModule:
        """Creates an ExternalModule instance from an Import instance.

        This class method creates a new ExternalModule object that represents an external module
        that can be referenced in the codebase, such as 'datetime' or other imported modules.
        External modules are added to the graph during import resolution.

        Args:
            imp (Import): An Import instance containing the module information.

        Returns:
            ExternalModule: A new ExternalModule instance representing the external module.
        """
        ...
    
    @property
    @reader
    def parameters(self) -> list[Parameter]:
        """Returns list of named parameters from an external function symbol.

        Retrieves the parameter list from an external module function. This is not yet implemented and will raise an error.

        Returns:
            list[Parameter]: A list of parameters associated with the external function.

        Raises:
            NotImplementedError: This functionality is not yet supported for external modules.
        """
        ...
    
    @reader
    def get_import_string(self, alias: str | None = ..., module: str | None = ..., import_type: ImportType = ..., is_type_import: bool = ...) -> str:
        """Returns the import string used to import this module.

        Gets the string representation needed to import this external module. This method is used to generate import statements.

        Args:
            alias (str | None, optional): An alternative name for the imported module.
            module (str | None, optional): The module from which to import.
            import_type (ImportType, optional): The type of import to generate. Defaults to ImportType.UNKNOWN.
            is_type_import (bool, optional): Whether this is a type import. Defaults to False.

        Returns:
            str: The import string that can be used to import this module.
        """
        ...
    
    @property
    def file(self) -> None:
        """File property for ExternalModule class.

        Returns None since ExternalModule represents an external module that is not part of any local file.

        Returns:
            None: Always returns None as ExternalModule is not associated with any file.
        """
        ...
    
    @property
    def filepath(self) -> str:
        """Returns the filepath of the module.

        For an ExternalModule, this will always return an empty string as it represents an external module that
        does not belong to the local codebase.

        Returns:
            str: An empty string representing the filepath of the external module.
        """
        ...
    
    @property
    @noapidoc
    def viz(self) -> VizNode:
        ...
    
    @noapidoc
    @reader
    def resolve_attribute(self, name: str) -> ExternalModule | None:
        ...
    
    def __hash__(self) -> int:
        ...
    
    @reader
    def __eq__(self, other: object) -> bool:
        ...
    


