use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct MessageContentImageFileObject {
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "image_file")]
pub image_file: Box<models::MessageContentImageFileObjectImageFile>,
}
impl MessageContentImageFileObject {
pub fn new(
r#type: Type,
image_file: models::MessageContentImageFileObjectImageFile,
) -> MessageContentImageFileObject {
MessageContentImageFileObject {
r#type,
image_file: Box::new(image_file),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "image_file")]
ImageFile,
}
impl Default for Type {
fn default() -> Type {
Self::ImageFile
}
}
impl std::fmt::Display for MessageContentImageFileObject {
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),
}
}
}