use serde::Deserialize;
use serde_json::Value as JsonValue;
use std::fmt::Display;
use utoipa::ToSchema;
#[derive(Deserialize, ToSchema)]
pub struct Chunk {
pub sequence_number: u64,
pub bin_data: Option<Vec<u8>>,
pub text_data: Option<String>,
#[schema(value_type = Option<Object>)]
pub json_data: Option<JsonValue>,
}
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, ToSchema)]
pub enum EgressMode {
#[serde(rename = "watch")]
Watch,
#[serde(rename = "snapshot")]
Snapshot,
}
impl Default for EgressMode {
fn default() -> Self {
Self::Watch
}
}
impl Display for EgressMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
EgressMode::Watch => write!(f, "watch"),
EgressMode::Snapshot => write!(f, "snapshot"),
}
}
}
pub const SERVER_PORT_FILE: &str = "port";