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

from typing import TYPE_CHECKING
from graph_sitter.codebase.codebase_graph import CodebaseGraph
from graph_sitter.core.autocommit import mover, reader, writer
from graph_sitter.core.file import SourceFile
from graph_sitter.core.interfaces.exportable import Exportable
from graph_sitter.core.statements.export_statement import ExportStatement
from graph_sitter.core.symbol import Symbol
from graph_sitter.enums import ImportType
from graph_sitter.extensions.utils import cached_property
from graph_sitter.typescript.assignment import TSAssignment
from graph_sitter.typescript.class_definition import TSClass
from graph_sitter.typescript.detached_symbols.code_block import TSCodeBlock
from graph_sitter.typescript.export import TSExport
from graph_sitter.typescript.function import TSFunction
from graph_sitter.typescript.import_resolution import TSImport
from graph_sitter.typescript.interface import TSInterface
from graph_sitter.typescript.interfaces.has_block import TSHasBlock
from graph_sitter.typescript.namespace import TSNamespace
from graph_sitter.typescript.symbol import TSSymbol
from graph_sitter.typescript.ts_config import TSConfig
from graph_sitter.typescript.type_alias import TSTypeAlias
from graph_sitter.writer_decorators import noapidoc, ts_apidoc

if TYPE_CHECKING:
    ...
@ts_apidoc
class TSFile(SourceFile[TSImport, TSFunction, TSClass, TSAssignment, TSInterface, TSCodeBlock], TSHasBlock, Exportable):
    """Extends the SourceFile class to provide TypeScript-specific functionality."""
    programming_language = ...
    ts_config: TSConfig | None = ...
    @cached_property
    @reader(cache=False)
    def exports(self) -> list[TSExport]:
        """Returns all Export symbols in the file.

        Retrieves a list of all top-level export declarations in the current TypeScript file.
        Does not include exports inside namespaces.

        Returns:
            list[TSExport]: A list of TSExport objects representing all top-level export declarations in the file.
        """
        ...
    
    @property
    @reader(cache=False)
    def export_statements(self) -> list[ExportStatement[TSExport]]:
        """Returns a list of all export statements in the file.

        Each export statement in the returned list can contain multiple exports. The export statements
        are sorted by their position in the file.

        Args:
            None

        Returns:
            list[ExportStatement[TSExport]]: A list of ExportStatement objects, where each ExportStatement
                contains one or more TSExport objects.
        """
        ...
    
    @property
    @reader(cache=False)
    def default_exports(self) -> list[TSExport]:
        """Returns all default export symbols from the file.

        A property method that retrieves all export objects that are designated as default exports from the file.

        Returns:
            list[TSExport]: A list of default export objects. Each object belongs to a single export statement.
        """
        ...
    
    @property
    @reader
    def named_exports(self) -> list[TSExport]:
        """Returns the named exports declared in the file.

        Gets all export statements in the file that are not default exports. These exports are defined
        using the `export` keyword rather than `export default`.

        Args:
            self (TSFile): The TypeScript file object.

        Returns:
            list[TSExport]: A list of TSExport objects representing named exports in the file.
        """
        ...
    
    @reader
    def get_export(self, export_name: str) -> TSExport | None:
        """Returns an export object with the specified name from the file.

        This method searches for an export with the given name in the file.

        Args:
            export_name (str): The name of the export to find.

        Returns:
            TSExport | None: The export object if found, None otherwise.
        """
        ...
    
    @property
    @reader
    def interfaces(self) -> list[TSInterface]:
        """Returns all Interfaces in the file.

        Retrieves all symbols in the file that are of type Interface.

        Args:
            None

        Returns:
            list[TSInterface]: A list of TypeScript interface symbols defined in the file.
        """
        ...
    
    @reader
    def get_interface(self, name: str) -> TSInterface | None:
        """Retrieves a specific interface from the file by its name.

        Args:
            name (str): The name of the interface to find.

        Returns:
            TSInterface | None: The interface with the specified name if found, None otherwise.
        """
        ...
    
    @property
    @reader
    def types(self) -> list[TSTypeAlias]:
        """Returns all type aliases in the file.

        Retrieves a list of all type aliases defined in the current TypeScript/JavaScript file.

        Returns:
            list[TSTypeAlias]: A list of all type aliases in the file. Empty list if no type aliases are found.
        """
        ...
    
    @reader
    def get_type(self, name: str) -> TSTypeAlias | None:
        """Returns a specific Type by name from the file's types.

        Retrieves a TypeScript type alias by its name from the file's collection of types.

        Args:
            name (str): The name of the type alias to retrieve.

        Returns:
            TSTypeAlias | None: The TypeScript type alias with the matching name, or None if not found.
        """
        ...
    
    @staticmethod
    def get_extensions() -> list[str]:
        """Returns a list of file extensions that this class can parse.

        Returns a list of file extensions for TypeScript and JavaScript files that this File class can parse and process.

        Returns:
            list[str]: A list of file extensions including '.tsx', '.ts', '.jsx', and '.js'.
        """
        ...
    
    def symbol_can_be_added(self, symbol: TSSymbol) -> bool:
        """Determines if a TypeScript symbol can be added to this file based on its type and JSX compatibility.

        This method checks whether a given symbol can be added to the current TypeScript file by validating its compatibility with the file's extension.
        In particular, it ensures that JSX functions are only added to appropriate file types (.tsx or .jsx).

        Args:
            symbol (TSSymbol): The TypeScript symbol to be checked.

        Returns:
            bool: True if the symbol can be added to this file, False otherwise.
        """
        ...
    
    @reader
    def get_config(self) -> TSConfig | None:
        """Returns the nearest tsconfig.json applicable to this file.

        Gets the TypeScript configuration for the current file by retrieving the nearest tsconfig.json file in the directory hierarchy.

        Returns:
            TSConfig | None: The TypeScript configuration object if found, None otherwise.
        """
        ...
    
    @writer
    def add_export_to_symbol(self, symbol: TSSymbol) -> None:
        """Adds an export keyword to a symbol in a TypeScript file.

        Marks a symbol for export by adding the 'export' keyword. This modifies the symbol's
        declaration to make it available for import by other modules.

        Args:
            symbol (TSSymbol): The TypeScript symbol (function, class, interface, etc.) to be exported.

        Returns:
            None
        """
        ...
    
    @writer
    def remove_unused_exports(self) -> None:
        """Removes unused exports from the file.

        Analyzes all exports in the file and removes any that are not used. An export is considered unused if it has no direct
        symbol usages and no re-exports that are used elsewhere in the codebase.

        When removing unused exports, the method also cleans up any related unused imports. For default exports, it removes
        the 'export default' keyword, and for named exports, it removes the 'export' keyword or the entire export statement.

        Args:
            None

        Returns:
            None
        """
        ...
    
    @reader
    def has_export_statement_for_path(self, relative_path: str, export_type: str = ...) -> bool:
        """Checks if the file has exports of specified type that contains the given path in single or double quotes.

        Args:
            relative_path (str): The path to check for in export statements
            export_type (str): Type of export to check for - "WILDCARD", "TYPE", or "EXPORT" (default)

        Returns:
            bool: True if there exists an export of specified type with the exact relative path (quoted)
                  in its source, False otherwise.
        """
        ...
    
    @reader
    def get_export_statement_for_path(self, relative_path: str, export_type: str = ...) -> ExportStatement | None:
        """Gets the first export of specified type that contains the given path in single or double quotes.

        Args:
            relative_path (str): The path to check for in export statements
            export_type (str): Type of export to get - "WILDCARD", "TYPE", or "EXPORT" (default)

        Returns:
            TSExport | None: The first matching export if found, None otherwise.
        """
        ...
    
    @noapidoc
    def get_import_module_name_for_file(self, filepath: str, G: CodebaseGraph) -> str:
        """Returns the module name that this file gets imported as"""
        ...
    
    @reader
    def get_import_string(self, alias: str | None = ..., module: str | None = ..., import_type: ImportType = ..., is_type_import: bool = ...) -> str:
        """Generates and returns an import statement for the file.

        Constructs an import statement string based on the file's name and module information.

        Args:
            alias (str | None): Alternative name for the imported module. Defaults to None.
            module (str | None): Module path to import from. If None, uses file's default module name.
            import_type (ImportType): The type of import statement. Defaults to ImportType.UNKNOWN.
            is_type_import (bool): Whether this is a type-only import. Defaults to False.

        Returns:
            str: A formatted import statement string importing all exports from the module.
        """
        ...
    
    @cached_property
    @noapidoc
    @reader(cache=True)
    def valid_import_names(self) -> dict[str, Symbol | TSImport]:
        """Returns a dict mapping name => Symbol (or import) in this file that can be imported from another file"""
        ...
    
    @mover
    def update_filepath(self, new_filepath: str): # -> None:
        """Updates the file path of the current file and all associated imports.

        Renames the current file to a new file path and updates all imports that reference this file to point to the new location.

        Args:
            new_filepath (str): The new file path to move the file to.

        Returns:
            None
        """
        ...
    
    @reader
    def get_namespace(self, name: str) -> TSNamespace | None:
        """Returns a specific namespace by name from the file's namespaces.

        Args:
            name (str): The name of the namespace to find.

        Returns:
            TSNamespace | None: The namespace with the specified name if found, None otherwise.
        """
        ...
    


