use serde::{Deserialize, Serialize};

use crate::diagnostic::RunDiagnostics;
use crate::module::ModuleMetadata;

#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct RunResult {
    pub output: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub diagnostics: Option<RunDiagnostics>,
}

impl RunResult {
    pub fn new(output: impl Into<String>) -> Self {
        Self {
            output: output.into(),
            diagnostics: None,
        }
    }

    pub fn with_diagnostics(mut self, d: RunDiagnostics) -> Self {
        self.diagnostics = Some(d);
        self
    }
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct AgentMetadata {
    pub agent_name: String,
    pub modules: Vec<ModuleMetadata>,
    pub sdk_version: String,
    pub declared_limits: std::collections::HashMap<String, String>,
    pub metadata: std::collections::HashMap<String, String>,
}
