"""
Type stubs for LogXide - High-performance logging for Python
"""

from typing import IO, Any, Callable

# Version information
__version__: str
__author__: str
__email__: str
__license__: str
__description__: str
__url__: str

# Logging levels
DEBUG: int
INFO: int
WARNING: int
WARN: int  # Alias for WARNING
ERROR: int
CRITICAL: int
FATAL: int  # Alias for CRITICAL
NOTSET: int

# Type aliases
LogLevel = int

class PyLogger:
    """High-performance logger implementation."""

    def __init__(self, name: str) -> None: ...
    @property
    def name(self) -> str: ...
    @property
    def level(self) -> int: ...
    @property
    def handlers(self) -> list: ...
    @property
    def manager(self) -> Any: ...
    @property
    def disabled(self) -> bool: ...
    @property
    def filters(self) -> list: ...
    def setLevel(self, level: LogLevel) -> None: ...
    def getEffectiveLevel(self) -> int: ...
    def addHandler(self, handler: Any) -> None: ...
    def removeHandler(self, handler: Any) -> None: ...
    def addFilter(self, filter: Any) -> None: ...
    def removeFilter(self, filter: Any) -> None: ...
    def disable(self, level: LogLevel) -> None: ...
    def setFormatter(self, formatter: Any) -> None: ...
    def getChild(self, suffix: str) -> PyLogger: ...
    def isEnabledFor(self, level: LogLevel) -> bool: ...
    def debug(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def info(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def warning(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def error(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def critical(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def exception(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def log(self, level: LogLevel, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def fatal(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def warn(self, msg: str, *args: Any, **kwargs: Any) -> None: ...
    def hasHandlers(self) -> bool: ...
    def getChildren(self) -> list: ...
    def makeRecord(
        self,
        name: str,
        level: int,
        fn: str,
        lno: int,
        msg: str,
        args: tuple,
        exc_info: Any,
    ) -> LogRecord: ...
    def handle(self, record: LogRecord) -> None: ...
    def callHandlers(self, record: LogRecord) -> None: ...
    def findCaller(self, stack_info: bool = False) -> tuple[str, int, str, Any]: ...
    @property
    def root(self) -> PyLogger: ...
    def filter(self, record: LogRecord) -> bool: ...

# Type alias for Logger
Logger = PyLogger

class LogRecord:
    """Basic LogRecord implementation for compatibility"""

    pass

class Filter:
    """Basic Filter implementation for compatibility"""

    pass

class LoggerAdapter:
    """Basic LoggerAdapter implementation for compatibility"""

    pass

class NullHandler:
    """A handler that does nothing."""

    def __init__(self) -> None: ...
    def handle(self, record: LogRecord) -> None: ...
    def emit(self, record: LogRecord) -> None: ...
    def __call__(self, record: LogRecord) -> None: ...

class Formatter:
    """Basic formatter class."""

    def __init__(self, fmt: str | None = None, datefmt: str | None = None) -> None: ...
    def format(self, record: LogRecord) -> str: ...

class Handler:
    """Basic handler class."""

    def __init__(self) -> None: ...
    def handle(self, record: LogRecord) -> None: ...
    def emit(self, record: LogRecord) -> None: ...
    def setFormatter(self, formatter: Formatter) -> None: ...
    def setLevel(self, level: LogLevel) -> None: ...
    def handleError(self, record: LogRecord) -> None: ...
    @property
    def terminator(self) -> str: ...
    def __call__(self, record: LogRecord) -> None: ...

class StreamHandler(Handler):
    """Stream handler class."""

    def __init__(self, stream: IO[str] | None = None) -> None: ...
    def emit(self, record: LogRecord) -> None: ...
    def flush(self) -> None: ...

class FileHandler(StreamHandler):
    """File handler class."""

    def __init__(
        self,
        filename: str,
        mode: str = "a",
        encoding: str | None = None,
        delay: bool = False,
    ) -> None: ...

class LoggingManager:
    """Mock logging manager for compatibility."""

    def __init__(self) -> None: ...
    disable: int

class _LoggingModule:
    """The main logging module interface."""

    # Static methods
    @staticmethod
    def getLogger(name: str | None = None) -> PyLogger: ...
    @staticmethod
    def basicConfig(**kwargs: Any) -> None: ...
    @staticmethod
    def flush() -> None: ...
    @staticmethod
    def register_python_handler(handler: Callable) -> None: ...
    @staticmethod
    def addLevelName(level: LogLevel, levelName: str) -> None: ...
    @staticmethod
    def getLevelName(level: LogLevel) -> str: ...
    @staticmethod
    def disable(level: LogLevel) -> None: ...
    @staticmethod
    def getLoggerClass() -> type[PyLogger]: ...
    @staticmethod
    def setLoggerClass(klass: type[PyLogger]) -> None: ...
    @staticmethod
    def captureWarnings(capture: bool) -> None: ...
    @staticmethod
    def makeLogRecord(dict: dict) -> LogRecord: ...
    @staticmethod
    def getLogRecordFactory() -> type[LogRecord]: ...
    @staticmethod
    def setLogRecordFactory(factory: type[LogRecord]) -> None: ...
    @staticmethod
    def getLevelNamesMapping() -> dict[str, int]: ...
    @staticmethod
    def getHandlerByName(name: str) -> Any: ...
    @staticmethod
    def getHandlerNames() -> list: ...

    # Level constants
    DEBUG: int
    INFO: int
    WARNING: int
    WARN: int
    ERROR: int
    CRITICAL: int
    FATAL: int
    NOTSET: int

    # Classes
    PyLogger: type[PyLogger]
    Logger: type[PyLogger]
    LogRecord: type[LogRecord]
    Filter: type[Filter]
    LoggerAdapter: type[LoggerAdapter]
    NullHandler: type[NullHandler]
    Formatter: type[Formatter]
    Handler: type[Handler]
    StreamHandler: type[StreamHandler]
    LoggingManager: type[LoggingManager]

    # Attributes
    root: PyLogger
    lastResort: NullHandler
    raiseExceptions: bool
    BASIC_FORMAT: str

# The main logging module instance
logging: _LoggingModule

# Core functions
def getLogger(name: str | None = None) -> PyLogger: ...
def basicConfig(**kwargs: Any) -> None: ...
def flush() -> None: ...
def register_python_handler(handler: Callable) -> None: ...

# Compatibility functions
def addLevelName(level: LogLevel, levelName: str) -> None: ...
def getLevelName(level: LogLevel) -> str: ...
def disable(level: LogLevel) -> None: ...
def getLoggerClass() -> type[PyLogger]: ...
def setLoggerClass(klass: type[PyLogger]) -> None: ...
def captureWarnings(capture: bool) -> None: ...
def makeLogRecord(dict: dict) -> LogRecord: ...
def getLogRecordFactory() -> type[LogRecord]: ...
def setLogRecordFactory(factory: type[LogRecord]) -> None: ...
def getLevelNamesMapping() -> dict[str, int]: ...
def getHandlerByName(name: str) -> Any: ...
def getHandlerNames() -> list: ...

# Installation functions

def uninstall() -> None:
    """Restore the standard logging module."""
    ...
