use oyui_rune_actions::define_actions;

use crate::config::LineHighlightMode;

define_actions! {
    global {
        quit()
        confirm()
        execute_merge()
        open_command_mode()
        confirm_merge_window_enabled { @getset(bool) }
    }
    theme {
        set(String)
        toggle_gradient()
        is_dark(|| -> bool)

        // Replace current syntax theme with an embedded
        // theme or via a provided path.
        syntax(String)

        bg { @getset(String) }
        fg { @getset(String) }
        cursor_bg { @getset(String) }
        dim { @getset(String) }
        staged { @getset(String) }
        unstaged { @getset(String) }
        partial { @getset(String) }
        dir { @getset(String) }
        cmd { @getset(String) }
        add_bg { @getset(String) }
        del_bg { @getset(String) }
        add_fg { @getset(String) }
        del_fg { @getset(String) }
        file_staged_highlight { @getset(LineHighlightMode) }
        file_staged_highlight_opacity { @getset(f64) }
        file_change_highlight { @getset(LineHighlightMode) }
        file_change_highlight_opacity { @getset(f64) }

        char_hunk_split { @getset(String) }
        char_hunk_split_color { @getset(String) }
        char_line_split { @getset(String) }
        char_line_split_color { @getset(String) }
        char_indicator { @getset(String) }
        char_add_sign { @getset(String) }
        char_del_sign { @getset(String) }
        char_trailing_space_fg { @getset(String) }
        char_tab_fg { @getset(String) }
        char_scroll_fg { @getset(String) }

        char_trailing_space { @getset(String) }
        char_tab { @getset(String) }
        char_scroll_both { @getset(String) }
        char_scroll_left { @getset(String) }
        char_scroll_right { @getset(String) }

        tree_progressive_change_dim { @getset(bool) }
    }
    view {
        file {
            scroll {
                left(u32)
                right(u32)
            }
            cursor {
                up(u32)
                down(u32)
                page_up()
                page_down()
                half_page_up()
                half_page_down()
                top()
                bottom()
            }
            nav {
                next_hunk()
                prev_hunk()
            }
            staging {
                toggle()
                toggle_hunk(u32)
                toggle_line()
                split()
                invert()
            }
            fold {
                toggle()
            }
            close()
        }
        tree {
            cursor {
                up(u32)
                down(u32)
                page_up()
                page_down()
                half_page_up()
                half_page_down()
                top()
                bottom()
            }
            directory {
                expand()
                collapse()
            }
            staging {
                toggle_selected()
                invert()
            }
            open_selected()
            open_file(String)
        }
    }
}
