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