"""
簡化的類型定義模塊

按照KISS原則重新設計，保留核心功能但大幅簡化類型定義。
去除過度複雜的overload和重複的方法定義。
"""
from typing import Any, Callable, Dict, List, Literal, Optional, Protocol, Union
from pathlib import Path

# 簡化的類型別名
LogLevelType = Literal["TRACE", "DEBUG", "INFO", "SUCCESS", "WARNING", "ERROR", "CRITICAL"]
LogHandlerIdType = int
LogFilterType = Callable[[Dict[str, Any]], bool]
LogConfigType = Dict[str, Any]
LogPathType = Union[str, Path]
LogNameFormatType = Optional[str]
LogRotationType = Union[str, int]

# 預設日誌格式名稱
LogNamePresetType = Literal["detailed", "simple", "daily", "hourly", "minute"]

# 輸出目標類型
OutputDestinationType = Literal["to_console_only", "to_log_file_only"]


class EnhancedLoggerProtocol(Protocol):
    """
    簡化的增強型 Logger 協議
    
    只定義必要的方法簽名，不再使用大量overload
    """
    
    # 基本日誌方法
    def debug(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def info(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def success(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def warning(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def error(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def critical(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    
    # 目標輸出方法（簡化）
    def console_info(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def console_warning(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def console_error(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def file_info(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def file_warning(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    def file_error(self, message: Any, *args: Any, **kwargs: Any) -> None: ...
    
    # 格式化方法（簡化）
    def block(self, title: str, message_list: List[str], **kwargs: Any) -> None: ...
    def ascii_header(self, text: str, **kwargs: Any) -> None: ...
    def ascii_block(self, title: str, message_list: List[str], **kwargs: Any) -> None: ...
    
    # FIGlet 方法（可選）
    def figlet_header(self, text: str, **kwargs: Any) -> None: ...
    def figlet_block(self, title: str, message_list: List[str], **kwargs: Any) -> None: ...
    
    # Loguru 核心方法
    def bind(self, **kwargs: Any) -> 'EnhancedLoggerProtocol': ...
    def opt(self, **kwargs: Any) -> 'EnhancedLoggerProtocol': ...
    def add(self, sink: Any, **kwargs: Any) -> LogHandlerIdType: ...
    def remove(self, handler_id: Optional[LogHandlerIdType] = None) -> None: ...


# 簡化的類型別名
EnhancedLogger = EnhancedLoggerProtocol