use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LiveDecisionStoredInputItemParam {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<Type>,
#[serde(rename = "role")]
pub role: Role,
#[serde(rename = "content")]
pub content: Box<models::LiveDecisionStoredInputItemParamContent>,
}
impl LiveDecisionStoredInputItemParam {
pub fn new(
id: String,
role: Role,
content: models::LiveDecisionStoredInputItemParamContent,
) -> LiveDecisionStoredInputItemParam {
LiveDecisionStoredInputItemParam {
id,
r#type: None,
role,
content: Box::new(content),
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "message")]
Message,
}
impl Default for Type {
fn default() -> Type {
Self::Message
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Role {
#[serde(rename = "user")]
User,
}
impl Default for Role {
fn default() -> Role {
Self::User
}
}
impl std::fmt::Display for LiveDecisionStoredInputItemParam {
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),
}
}
}