use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct BetaFunctionShellCallItemParam {
#[serde(
rename = "agent",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub agent: Option<Option<Box<models::BetaAgentTagParam>>>,
#[serde(
rename = "id",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub id: Option<Option<String>>,
#[serde(rename = "call_id")]
pub call_id: String,
#[serde(
rename = "caller",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub caller: Option<Option<Box<models::BetaToolCallCallerParam>>>,
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "action")]
pub action: Box<models::BetaFunctionShellActionParam>,
#[serde(
rename = "status",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub status: Option<Option<models::BetaFunctionShellCallItemStatus>>,
#[serde(
rename = "environment",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub environment: Option<Option<Box<models::BetaFunctionShellCallItemParamEnvironment>>>,
}
impl BetaFunctionShellCallItemParam {
pub fn new(
call_id: String,
r#type: Type,
action: models::BetaFunctionShellActionParam,
) -> BetaFunctionShellCallItemParam {
BetaFunctionShellCallItemParam {
agent: None,
id: None,
call_id,
caller: None,
r#type,
action: Box::new(action),
status: None,
environment: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "shell_call")]
ShellCall,
}
impl Default for Type {
fn default() -> Type {
Self::ShellCall
}
}
impl std::fmt::Display for BetaFunctionShellCallItemParam {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}