//! Reset confirmation actions.
//!
//! Handles reset request confirmations and cancellations.

use crate::app::{actions::Action, state::AppState};

/// Handle reset-related actions.
pub fn handle_reset(state: &mut AppState, action: &Action) -> bool {
    match action {
        Action::RequestResetHard => {
            state.reset_pending = Some("--hard".into());
            state.feedback_message = Some("Confirm hard reset: press again to execute (Esc to cancel)".into());
            true
        }
        Action::RequestResetMixed => {
            state.reset_pending = Some("--mixed".into());
            state.feedback_message = Some("Confirm mixed reset: press again to execute (Esc to cancel)".into());
            true
        }
        Action::RequestResetSoft => {
            state.reset_pending = Some("--soft".into());
            state.feedback_message = Some("Confirm soft reset: press again to execute (Esc to cancel)".into());
            true
        }
        Action::ResetHard | Action::ResetMixed | Action::ResetSoft => {
            state.reset_pending = None;
            state.feedback_message = None;
            true
        }
        Action::CancelReset => {
            state.reset_pending = None;
            state.feedback_message = None;
            true
        }
        _ => false,
    }
}

