use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ResponseImageGenCallPartialWsImage {
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "output_index")]
pub output_index: i32,
#[serde(rename = "item_id")]
pub item_id: String,
#[serde(rename = "sequence_number")]
pub sequence_number: i32,
#[serde(rename = "partial_image_index")]
pub partial_image_index: i32,
#[serde(rename = "partial_image_b64")]
pub partial_image_b64: String,
#[serde(rename = "size", skip_serializing_if = "Option::is_none")]
pub size: Option<String>,
#[serde(rename = "quality", skip_serializing_if = "Option::is_none")]
pub quality: Option<String>,
#[serde(rename = "background", skip_serializing_if = "Option::is_none")]
pub background: Option<String>,
#[serde(rename = "output_format", skip_serializing_if = "Option::is_none")]
pub output_format: Option<String>,
#[serde(rename = "stream_id", skip_serializing_if = "Option::is_none")]
pub stream_id: Option<String>,
}
impl ResponseImageGenCallPartialWsImage {
pub fn new(
r#type: Type,
output_index: i32,
item_id: String,
sequence_number: i32,
partial_image_index: i32,
partial_image_b64: String,
) -> ResponseImageGenCallPartialWsImage {
ResponseImageGenCallPartialWsImage {
r#type,
output_index,
item_id,
sequence_number,
partial_image_index,
partial_image_b64,
size: None,
quality: None,
background: None,
output_format: None,
stream_id: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "response.image_generation_call.partial_image")]
ResponseImageGenerationCallPartialImage,
}
impl Default for Type {
fn default() -> Type {
Self::ResponseImageGenerationCallPartialImage
}
}
impl std::fmt::Display for ResponseImageGenCallPartialWsImage {
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),
}
}
}