use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ComputerUseCallItemResource {
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "turn_id")]
pub turn_id: String,
#[serde(rename = "title", deserialize_with = "Option::deserialize")]
pub title: Option<String>,
#[serde(rename = "status")]
pub status: models::FunctionCallStatusResource,
#[serde(rename = "output", deserialize_with = "Option::deserialize")]
pub output: Option<models::ComputerScreenshotResource>,
}
impl ComputerUseCallItemResource {
pub fn new(
r#type: Type,
id: String,
turn_id: String,
title: Option<String>,
status: models::FunctionCallStatusResource,
output: Option<models::ComputerScreenshotResource>,
) -> ComputerUseCallItemResource {
ComputerUseCallItemResource {
r#type,
id,
turn_id,
title,
status,
output,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "computer_use_call")]
ComputerUseCall,
}
impl Default for Type {
fn default() -> Type {
Self::ComputerUseCall
}
}
impl std::fmt::Display for ComputerUseCallItemResource {
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),
}
}
}