"""Thư viện dùng chung (Common Foundation Library) của AutoPOE2.

Cung cấp các tiện ích nền tảng Win32, quản lý tiến trình, nhập liệu chuột/phím,
thị giác máy tính WinOCR, chụp màn hình, phát âm thanh phản hồi,
cấu trúc dữ liệu vật phẩm và hệ thống log chuẩn tắc.
Đóng vai trò Single Source of Truth (SSoT) cho toàn bộ tầng Python Companion.
"""

from src.common.audio_feedback import (
    beep_bot_toggle,
    beep_notification,
    beep_panic,
)
from src.common.coordinate_transform import (
    CoordinateScaler,
    Resolution,
    ScalingMode,
    RES_1080P,
    RES_1440P,
    RES_720P,
    RES_4K,
    RES_WINDOWED_DEFAULT,
    get_faustus_element_pos,
    get_inventory_slot_pos,
    get_stash_slot_pos,
    get_traverse_button_bbox,
    get_traverse_button_pos,
    get_waystone_socket_pos,
    get_waystone_tray_slot_pos,
    resolve_resolution,
)
from src.common.item_types import (
    AffixData,
    AffixType,
    ItemData,
    ItemRarity,
)
from src.common.logging_util import (
    get_logger,
    log_exception,
)
from src.common.screen_capture import (
    capture_rect_bitblt,
    capture_window_bitblt,
    capture_window_print,
)
from src.common.vision_filters import (
    apply_clahe_fast,
    dual_pass_enhance_image,
    find_traverse_button_dual_pass,
    is_atlas_ui_open_robust,
    sobel_edge_magnitude,
)
from src.common.vision_ocr import (
    find_active_glowing_atlas_node,
    find_all_reachable_green_nodes,
    find_button_by_text,
    find_color_clusters,
    find_endgame_tab_pos,
    find_map_device_screen_pos,
    find_player_avatar_on_atlas,
    find_portal_label_by_ocr,
    find_portal_screen_pos,
    find_reachable_green_node,
    find_traverse_button_screen_pos,
    is_atlas_node_depleted,
    is_atlas_ui_open,
    is_center_modal_present,
    is_inventory_open,
    is_loading_screen,
    is_map_device_visible,
    is_game_menu_visible,
    safe_recognize_pil_sync,
)
from src.common.win32_input import (
    VK_A,
    VK_D,
    VK_ESCAPE,
    VK_F8,
    VK_I,
    VK_OEM_PERIOD,
    VK_PAUSE,
    VK_S,
    VK_SPACE,
    VK_U,
    VK_W,
    SC_ESCAPE,
    SC_SPACE,
    client_to_screen_pos,
    click,
    ctrl_click,
    dismiss_modals,
    drag,
    emergency_release_wasd_keys,
    get_cursor_pos,
    _is_focus_allowed,
    _is_physical_allowed,
    get_input_simulation_mode,
    hover,
    mouse_wheel,
    post_message_click,
    post_message_ctrl_click,
    post_message_drag,
    post_message_hover,
    post_message_key,
    press_key,
    send_wasd_direction,
    set_cursor_pos,
    set_input_simulation_mode,
)
from src.common.win32_process import (
    find_process_by_name,
    get_poe2_pid,
    get_process_name_by_pid,
    is_poe2_pid,
    is_poe2_running,
)
from src.common.win32_window import (
    attach_to_default_desktop,
    find_poe2_window,
    get_client_rect,
    get_dpi_scale,
    is_poe2_window_focused,
    snap_window_to_half,
    position_poe2_window_safely,
)

__all__ = [
    # Win32 Window
    "attach_to_default_desktop",
    "find_poe2_window",
    "get_client_rect",
    "get_dpi_scale",
    "is_poe2_window_focused",
    "snap_window_to_half",
    "position_poe2_window_safely",
    # Win32 Process
    "is_poe2_running",
    "get_poe2_pid",
    "get_process_name_by_pid",
    "is_poe2_pid",
    "find_process_by_name",
    # Win32 Input
    "get_cursor_pos",
    "set_cursor_pos",
    "client_to_screen_pos",
    "hover",
    "click",
    "ctrl_click",
    "drag",
    "emergency_release_wasd_keys",
    "post_message_hover",
    "post_message_click",
    "post_message_ctrl_click",
    "post_message_drag",
    "post_message_key",
    "press_key",
    "dismiss_modals",
    "send_wasd_direction",
    "_is_focus_allowed",
    "_is_physical_allowed",
    "set_input_simulation_mode",
    "get_input_simulation_mode",
    "mouse_wheel",
    "VK_W",
    "VK_A",
    "VK_S",
    "VK_D",
    "VK_ESCAPE",
    "VK_SPACE",
    "VK_I",
    "VK_U",
    "VK_F8",
    "VK_PAUSE",
    "VK_OEM_PERIOD",
    "SC_ESCAPE",
    "SC_SPACE",
    # Vision & OCR
    "is_atlas_ui_open",
    "is_atlas_ui_open_robust",
    "is_center_modal_present",
    "is_inventory_open",
    "is_loading_screen",
    "is_map_device_visible",
    "is_game_menu_visible",
    "safe_recognize_pil_sync",
    "find_button_by_text",
    "find_endgame_tab_pos",
    "find_traverse_button_dual_pass",
    "find_traverse_button_screen_pos",
    "find_color_clusters",
    "find_map_device_screen_pos",
    "find_player_avatar_on_atlas",
    "find_portal_label_by_ocr",
    "find_portal_screen_pos",
    "find_reachable_green_node",
    "find_all_reachable_green_nodes",
    "is_atlas_node_depleted",
    "apply_clahe_fast",
    "sobel_edge_magnitude",
    "dual_pass_enhance_image",
    # Screen Capture
    "capture_rect_bitblt",
    "capture_window_bitblt",
    "capture_window_print",
    # Audio Feedback
    "beep_bot_toggle",
    "beep_panic",
    "beep_notification",
    # Item Types
    "ItemRarity",
    "AffixType",
    "AffixData",
    "ItemData",
    # Logging
    "get_logger",
    "log_exception",
    # Coordinate Transform & Dynamic Resolution Scaling Engine
    "CoordinateScaler",
    "Resolution",
    "ScalingMode",
    "RES_1080P",
    "RES_1440P",
    "RES_720P",
    "RES_4K",
    "RES_WINDOWED_DEFAULT",
    "get_traverse_button_pos",
    "get_traverse_button_bbox",
    "get_waystone_socket_pos",
    "get_waystone_tray_slot_pos",
    "get_inventory_slot_pos",
    "get_stash_slot_pos",
    "get_faustus_element_pos",
    "resolve_resolution",
]
