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