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