use serde::{Deserialize, Serialize};
/// This object represents a sticker set.
/// # Documentation
/// <https://core.telegram.org/bots/api#stickerset>
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct StickerSet {
    /// Sticker set name
    pub name: Box<str>,
    /// Sticker set title
    pub title: Box<str>,
    /// Type of stickers in the set, currently one of `regular`, `mask`, `custom_emoji`
    pub sticker_type: Box<str>,
    /// List of all set stickers
    pub stickers: Box<[crate::types::Sticker]>,
    /// Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
    #[serde(skip_serializing_if = "Option::is_none")]
    pub thumbnail: Option<crate::types::PhotoSize>,
}
impl StickerSet {
    /// Creates a new `StickerSet`.
    ///
    /// # Arguments
    /// * `name` - Sticker set name
    /// * `title` - Sticker set title
    /// * `sticker_type` - Type of stickers in the set, currently one of `regular`, `mask`, `custom_emoji`
    /// * `stickers` - List of all set stickers
    ///
    /// # Notes
    /// Use builder methods to set optional fields.
    #[must_use]
    pub fn new<
        T0: Into<Box<str>>,
        T1: Into<Box<str>>,
        T2: Into<Box<str>>,
        T3Item: Into<crate::types::Sticker>,
        T3: IntoIterator<Item = T3Item>,
    >(
        name: T0,
        title: T1,
        sticker_type: T2,
        stickers: T3,
    ) -> Self {
        Self {
            name: name.into(),
            title: title.into(),
            sticker_type: sticker_type.into(),
            stickers: stickers.into_iter().map(Into::into).collect(),
            thumbnail: None,
        }
    }

    /// Sticker set name
    #[must_use]
    pub fn name<T: Into<Box<str>>>(mut self, val: T) -> Self {
        self.name = val.into();
        self
    }

    /// Sticker set title
    #[must_use]
    pub fn title<T: Into<Box<str>>>(mut self, val: T) -> Self {
        self.title = val.into();
        self
    }

    /// Type of stickers in the set, currently one of `regular`, `mask`, `custom_emoji`
    #[must_use]
    pub fn sticker_type<T: Into<Box<str>>>(mut self, val: T) -> Self {
        self.sticker_type = val.into();
        self
    }

    /// List of all set stickers
    ///
    /// # Notes
    /// Adds multiple elements.
    #[must_use]
    pub fn stickers<T: Into<Box<[crate::types::Sticker]>>>(mut self, val: T) -> Self {
        self.stickers = self
            .stickers
            .into_vec()
            .into_iter()
            .chain(val.into())
            .collect();
        self
    }

    /// List of all set stickers
    ///
    /// # Notes
    /// Adds a single element.
    #[must_use]
    pub fn sticker<T: Into<crate::types::Sticker>>(mut self, val: T) -> Self {
        self.stickers = self
            .stickers
            .into_vec()
            .into_iter()
            .chain(Some(val.into()))
            .collect();
        self
    }

    /// Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
    #[must_use]
    pub fn thumbnail<T: Into<crate::types::PhotoSize>>(mut self, val: T) -> Self {
        self.thumbnail = Some(val.into());
        self
    }

    /// Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
    #[must_use]
    pub fn thumbnail_option<T: Into<crate::types::PhotoSize>>(mut self, val: Option<T>) -> Self {
        self.thumbnail = val.map(Into::into);
        self
    }
}
