//! Rebase-related command definitions.
//!
//! Commands for rebase operations and interactive rebase todo management.

use super::super::command::{CommandCategory, CommandDef, CommandId};
use crate::app::Action;

pub fn rebase_commands() -> Vec<CommandDef> {
    vec![
        CommandDef {
            id: CommandId::RebaseContinue,
            name: "Rebase continue",
            key: "rc",
            category: CommandCategory::Rebase,
            description: "Continue rebase after resolving conflicts",
            action_factory: |_| Some(Action::RebaseContinue),
            is_enabled: |state| state.show_rebase_todo || state.conflicts_guided,
            keywords: &["rebase", "continue", "next"],
        },
        CommandDef {
            id: CommandId::RebaseAbort,
            name: "Rebase abort",
            key: "ra",
            category: CommandCategory::Rebase,
            description: "Abort the current rebase",
            action_factory: |_| Some(Action::RebaseAbort),
            is_enabled: |state| state.show_rebase_todo || state.conflicts_guided,
            keywords: &["rebase", "abort", "cancel"],
        },
        CommandDef {
            id: CommandId::RebaseSkip,
            name: "Rebase skip",
            key: "rk",
            category: CommandCategory::Rebase,
            description: "Skip current rebase step",
            action_factory: |_| Some(Action::RebaseSkip),
            is_enabled: |state| state.show_rebase_todo,
            keywords: &["rebase", "skip", "next"],
        },
        CommandDef {
            id: CommandId::RebaseTodo,
            name: "Rebase todo",
            key: "rt",
            category: CommandCategory::Rebase,
            description: "Show interactive rebase todo",
            action_factory: |_| Some(Action::ShowRebaseTodo),
            is_enabled: |_| true,
            keywords: &["rebase", "todo", "interactive"],
        },
        CommandDef {
            id: CommandId::RebaseTodoSave,
            name: "Save rebase todo",
            key: "rtsv",
            category: CommandCategory::Rebase,
            description: "Save rebase todo to disk",
            action_factory: |_| Some(Action::SaveRebaseTodo),
            is_enabled: |state| state.show_rebase_todo,
            keywords: &["rebase", "todo", "save"],
        },
    ]
}

