use serde::Deserialize;
use serde_json::json;

use super::ToolResult;

#[derive(Debug, Default, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct StatusParams {}

pub async fn execute(_params: StatusParams) -> ToolResult {
    let root = envseal::ops::vault_root().map_err(|e| e.to_string())?;
    let status = envseal::ops::vault_status(&root).map_err(|e| e.to_string())?;

    Ok(json!({
        "vault_root": status.root,
        "secret_count": status.secret_count,
        "initialized": status.initialized,
        "envseal_found": status.envseal_found,
        "security_tier": status.security_tier,
        "last_audit": status.last_audit
    }))
}
