use super::attachment::Attachment;
use crate::Keyboard;
use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)]
pub struct Message<T = ()> {
pub client_info: ClientInfo,
pub message: PersonalMessage<T>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct ClientInfo {
pub button_actions: Vec<String>,
pub keyboard: bool,
pub inline_keyboard: bool,
pub carousel: bool,
pub lang_id: i32,
}
#[derive(Debug, Deserialize, Clone)]
pub struct ReplyMessage<T> {
pub id: i32,
pub date: i64,
pub peer_id: i32,
pub from_id: i32,
pub text: String,
pub attachments: Vec<Attachment<T>>,
pub payload: Option<String>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct PersonalMessage<T> {
pub id: i32,
pub date: i64,
pub peer_id: i32,
pub from_id: i32,
pub text: String,
pub random_id: i32,
#[serde(rename = "ref")]
pub reference: Option<String>,
pub ref_source: Option<String>,
pub attachments: Vec<Attachment<T>>,
pub important: bool,
pub geo: Option<Geo>,
pub payload: Option<String>,
pub keyboard: Option<Keyboard<T>>,
pub fwd_messages: Vec<PersonalMessage<T>>,
pub reply_message: Option<ReplyMessage<T>>,
pub action: Option<Action>,
pub admin_author_id: Option<i32>,
pub conversation_message_id: i32,
pub is_cropped: Option<bool>,
pub members_count: Option<i32>,
pub update_time: Option<i64>,
pub was_listened: Option<bool>,
pub pinned_at: Option<i64>,
pub message_tag: Option<String>,
pub is_mentioned_user: Option<bool>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Geo {
#[serde(rename = "type")]
pub geo_type: String,
pub coordinates: Coordinates,
pub place: Option<Place>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Coordinates {
pub latitude: f64,
pub longitude: f64,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Place {
pub id: Option<i64>,
pub title: Option<String>,
pub latitude: f64,
pub longitude: f64,
pub created: Option<i64>,
pub icon: Option<String>,
pub country: Option<String>,
pub city: Option<String>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Action {
#[serde(rename = "type")]
pub action_type: String,
pub member_id: Option<i64>,
pub text: Option<String>,
pub email: Option<String>,
pub photo: Option<Photo>,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Photo {
pub photo_50: String,
pub photo_100: String,
pub photo_200: String,
}