use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct DecisionInputFunctionCall {
#[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 = "namespace",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub namespace: Option<Option<String>>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "arguments")]
pub arguments: String,
#[serde(
rename = "status",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub status: Option<Option<models::FunctionCallStatusParam>>,
#[serde(rename = "type")]
pub r#type: Type,
}
impl DecisionInputFunctionCall {
pub fn new(
call_id: String,
name: String,
arguments: String,
r#type: Type,
) -> DecisionInputFunctionCall {
DecisionInputFunctionCall {
id: None,
call_id,
namespace: None,
name,
arguments,
status: None,
r#type,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "function_call")]
FunctionCall,
}
impl Default for Type {
fn default() -> Type {
Self::FunctionCall
}
}
impl std::fmt::Display for DecisionInputFunctionCall {
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),
}
}
}