use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct TextResource {
#[serde(rename = "format")]
pub format: Box<models::TextFormatResource>,
#[serde(rename = "verbosity")]
pub verbosity: models::VerbosityResource,
}
impl TextResource {
pub fn new(
format: models::TextFormatResource,
verbosity: models::VerbosityResource,
) -> TextResource {
TextResource {
format: Box::new(format),
verbosity,
}
}
}
impl std::fmt::Display for TextResource {
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),
}
}
}