use crate::file::PhotoSize;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Sticker {
pub file_id: String,
pub file_unique_id: String,
#[serde(rename = "type")]
pub kind: StickerType,
pub width: u32,
pub height: u32,
pub is_animated: bool,
pub is_video: bool,
pub thumbnail: Option<PhotoSize>,
pub emoji: Option<String>,
pub set_name: Option<String>,
pub premium_animation: Option<crate::file::File>,
pub mask_position: Option<MaskPosition>,
pub custom_emoji_id: Option<String>,
pub needs_repainting: Option<bool>,
pub file_size: Option<u64>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum StickerType {
Regular,
Mask,
CustomEmoji,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MaskPosition {
pub point: MaskPoint,
pub x_shift: f64,
pub y_shift: f64,
pub scale: f64,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum MaskPoint {
Forehead,
Eyes,
Mouth,
Chin,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StickerSet {
pub name: String,
pub title: String,
pub sticker_type: StickerType,
pub stickers: Vec<Sticker>,
pub thumbnail: Option<PhotoSize>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct InputSticker {
pub sticker: String,
pub format: StickerFormat,
pub emoji_list: Vec<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_position: Option<MaskPosition>,
#[serde(skip_serializing_if = "Option::is_none")]
pub keywords: Option<Vec<String>>,
}
impl InputSticker {
pub fn new(
sticker: impl Into<String>,
format: StickerFormat,
emoji_list: Vec<impl Into<String>>,
) -> Self {
Self {
sticker: sticker.into(),
format,
emoji_list: emoji_list.into_iter().map(Into::into).collect(),
mask_position: None,
keywords: None,
}
}
pub fn mask_position(mut self, mp: MaskPosition) -> Self {
self.mask_position = Some(mp);
self
}
pub fn keywords(mut self, kw: Vec<impl Into<String>>) -> Self {
self.keywords = Some(kw.into_iter().map(Into::into).collect());
self
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum StickerFormat {
Static,
Animated,
Video,
}