# core/handlers/__init__.py
from __future__ import annotations

from core.handler import EventDispatcher
from core.protocol import IncomingCallback, IncomingCommand, IncomingMessage
from core.handlers import callback, chat, message, settings, start


def register_all(dispatcher: EventDispatcher) -> None:
    # Commands
    dispatcher.register(IncomingCommand, "start",    start.handle_start)
    dispatcher.register(IncomingCommand, "new",      chat.handle_new_chat)
    dispatcher.register(IncomingCommand, "rename",   chat.handle_rename)
    dispatcher.register(IncomingCommand, "archive",  chat.handle_archive)
    dispatcher.register(IncomingCommand, "chats",    chat.handle_list_chats)
    dispatcher.register(IncomingCommand, "settings", settings.handle_settings)

    # Messages — catch-all (audio falls back here until voice_handler registered)
    dispatcher.register(IncomingMessage, "*", message.handle_message)

    # Callbacks
    dispatcher.register(IncomingCallback, "confirm",      callback.handle_confirm)
    dispatcher.register(IncomingCallback, "cancel",       callback.handle_cancel)
    dispatcher.register(IncomingCallback, "toggle_skill", callback.handle_toggle_skill)
