"""
Key bindings configuration for the hosts TUI application.

This module defines all keyboard shortcuts and bindings used
throughout the application.
"""

from textual.binding import Binding

# Key bindings for the hosts manager application
HOSTS_MANAGER_BINDINGS = [
    Binding("n", "add_entry", "New entry", show=True, id="left:new_entry"),
    Binding("d", "delete_entry", "Delete entry", show=True, id="left:delete_entry"),
    Binding("e", "edit_entry", "Edit entry", show=True, id="left:edit_entry"),
    Binding(
        "space",
        "toggle_entry",
        "Toggle active/inactive",
        show=True,
        id="left:toggle_entry",
    ),
    Binding(
        "ctrl+e",
        "toggle_edit_mode",
        "Toggle edit mode",
        show=True,
        id="left:toggle_edit_mode",
    ),
    Binding("c", "config", "Configuration", show=True, id="right:config"),
    Binding(
        "question_mark",
        "help",
        "Show help",
        show=True,
        key_display="?",
        id="right:help",
    ),
    Binding("q", "quit", "Quit", show=True, id="right:quit"),
    Binding("ctrl+r", "reload", "Reload hosts file", show=False),
    Binding("i", "sort_by_ip", "Sort by IP address", show=False),
    Binding("h", "sort_by_hostname", "Sort by hostname", show=False),
    Binding("ctrl+s", "save_file", "Save hosts file", show=False),
    Binding("shift+up", "move_entry_up", "Move entry up", show=False),
    Binding("shift+down", "move_entry_down", "Move entry down", show=False),
    Binding("ctrl+z", "undo", "Undo", show=False, id="left:undo"),
    Binding("ctrl+y", "redo", "Redo", show=False, id="left:redo"),
    Binding("R", "refresh_dns", "Update all DNS based Entries", show=False, id="left:refresh_dns"),
    Binding("r", "update_single_dns", "Update selected DNS based Entry", show=False, id="left:update_single_dns"),
    Binding("escape", "exit_edit_entry", "Exit edit mode", show=False),
    Binding("tab", "next_field", "Next field", show=False),
    Binding("shift+tab", "prev_field", "Previous field", show=False),
    ("ctrl+c", "quit", "Quit"),
]
