from collections.abc import Iterable, Mapping
from typing import Any, TypeVar

from ..utils.types import Adapter, AdapterRegistry, ArgsRegistry, ModuleRegistry, Set

__all__: list[str]

_T = TypeVar("_T")

_lazy_modules: ModuleRegistry
_ADAPTERS: AdapterRegistry
_CONSTRUCTOR_DEFAULTS: ArgsRegistry[Any]
_LAZY_LIBRARY_HANDLERS: Set[str]

# ======================================================
# Adapters registry
# ======================================================
def fqname_for_cls(cls: type[Any]) -> str: ...
def register_adapter(cls: type[Any], func: Adapter) -> Any: ...
def unregister_adapter(cls: type[Any]) -> None: ...
def get_adapter_registry() -> AdapterRegistry: ...
def _ensure_library_adapters(obj: Any) -> None: ...
def _get_adapter_for_type(t: type[Any]) -> Adapter | None: ...
def get_adapter(x: Any) -> Adapter | None: ...

# ======================================================
# Safe constructors
# ======================================================
def register_constructor_defaults(cls: type[Any], /, **defaults: Any) -> None: ...
def unregister_constructor_defaults(cls: type[Any]) -> None: ...
def get_defaults_registry() -> ArgsRegistry[Any]: ...
def construct_from_iterable(cls: type[_T], iterable: Iterable[Any]) -> Any: ...
def construct_from_mapping(cls: type[_T], items: Mapping[Any, Any]) -> Any: ...

# ======================================================
# Plugin discovery
# ======================================================
def discover_and_register_plugins(package_name: str) -> list[str]: ...
