use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub struct StatusResponse {
pub version: Version,
pub players: Players,
#[serde(rename = "description")]
pub motd: ChatObject,
pub favicon: Option<String>,
#[serde(rename = "previewsChat")]
pub previews_chat: Option<bool>,
#[serde(rename = "enforcesSecureChat")]
pub enforces_secure_chat: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Players {
pub max: u32,
pub online: u32,
pub sample: Option<Vec<Sample>>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Sample {
pub name: String,
pub id: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Version {
pub name: String,
pub protocol: u64,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ChatObject {
Object(ChatComponentObject),
Array(Vec<ChatObject>),
JsonPrimitive(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ChatComponentObject {
pub text: Option<String>,
pub translate: Option<String>,
pub keybind: Option<String>,
pub bold: Option<bool>,
pub italic: Option<bool>,
pub underlined: Option<bool>,
pub strikethrough: Option<bool>,
pub obfuscated: Option<bool>,
pub font: Option<String>,
pub color: Option<String>,
pub insertion: Option<String>,
#[serde(rename = "clickEvent")]
pub click_event: Option<ChatClickEvent>,
#[serde(rename = "hoverEvent")]
pub hover_event: Option<ChatHoverEvent>,
pub extra: Option<Vec<ChatObject>>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ChatClickEvent {
pub open_url: Option<String>,
pub run_command: Option<String>,
pub suggest_command: Option<String>,
pub copy_to_clipboard: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ChatHoverEvent {
pub show_text: Option<Box<ChatObject>>,
pub value: Option<Box<ChatObject>>,
pub show_item: Option<String>,
pub show_entity: Option<String>,
}