//! Tauri 命令模块
//! 定义所有前端可调用的命令

mod discovery_commands;
mod chat_commands;
mod file_commands;
mod config_commands;

pub use discovery_commands::*;
pub use chat_commands::*;
pub use file_commands::*;
pub use config_commands::*;

use tauri::ipc::Invoke;

/// 注册所有命令
pub fn get_handlers() -> impl Fn(Invoke) -> bool {
    tauri::generate_handler![
        // 发现服务命令
        start_discovery_service,
        stop_discovery_service,
        get_discovered_devices,
        get_known_devices,
        // WebSocket 命令
        start_websocket_server,
        stop_websocket_server,
        connect_to_peer,
        disconnect_from_peer,
        // 聊天命令
        send_chat_message,
        get_chat_history,
        delete_chat_history,
        get_conversations,
        // 文件传输命令
        start_http_server,
        stop_http_server,
        select_file_to_send,
        send_file,
        cancel_transfer,
        get_transfer_history,
        open_file_location,
        // 配置命令
        get_app_config,
        update_device_name,
        update_download_dir,
        get_local_device_info,
    ]
}
