//! Decision types for Claude orchestration

use serde::{Deserialize, Serialize};
use std::collections::HashMap;

/// Context provided to Claude for making a decision
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DecisionContext {
    /// Current state of the plan execution
    pub plan_state: String,
    /// Results of completed steps
    pub step_results: HashMap<String, serde_json::Value>,
    /// Available actions Claude can take
    pub available_actions: Vec<String>,
    /// Constraints on the decision
    pub constraints: Vec<String>,
}

impl DecisionContext {
    /// Create a new decision context
    #[must_use]
    pub fn new() -> Self {
        Self {
            plan_state: String::new(),
            step_results: HashMap::new(),
            available_actions: Vec::new(),
            constraints: Vec::new(),
        }
    }
}

impl Default for DecisionContext {
    fn default() -> Self {
        Self::new()
    }
}

/// A decision made by Claude
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClaudeDecision {
    /// The action to take
    pub action: DecisionAction,
    /// Reasoning behind the decision
    pub reasoning: String,
    /// Confidence level (0.0 to 1.0)
    pub confidence: f64,
}

/// Actions Claude can decide to take
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum DecisionAction {
    /// Continue with the specified step
    ContinueWithStep {
        /// The step ID to continue with
        step_id: String,
    },
    /// Modify the plan
    ModifyPlan {
        /// Description of the modification
        modification: String,
    },
    /// Retry the specified step
    RetryStep {
        /// The step ID to retry
        step_id: String,
    },
    /// Request input from the user
    RequestUserInput {
        /// The question to ask the user
        question: String,
    },
    /// Skip the specified step
    SkipStep {
        /// The step ID to skip
        step_id: String,
        /// Reason for skipping
        reason: String,
    },
    /// Abort the execution
    Abort {
        /// Reason for aborting
        reason: String,
    },
}
