use crate::client::Bot;
use serde::Serialize;
/// Use this method to create a subscription invite link for a channel chat. The bot must have the `can_invite_users` administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a [`crate::types::ChatInviteLink`] object.
/// # Documentation
/// <https://core.telegram.org/bots/api#createchatsubscriptioninvitelink>
/// # Returns
/// - `crate::types::ChatInviteLink`
#[derive(Clone, Debug, Serialize)]
pub struct CreateChatSubscriptionInviteLink {
    /// Unique identifier for the target channel chat or username of the target channel in the format @username
    pub chat_id: crate::types::ChatIdKind,
    /// Invite link name; 0-32 characters
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<Box<str>>,
    /// The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
    pub subscription_period: i64,
    /// The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000
    pub subscription_price: u16,
}
impl CreateChatSubscriptionInviteLink {
    /// Creates a new `CreateChatSubscriptionInviteLink`.
    ///
    /// # Arguments
    /// * `chat_id` - Unique identifier for the target channel chat or username of the target channel in the format @username
    /// * `subscription_period` - The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
    /// * `subscription_price` - The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000
    ///
    /// # Notes
    /// Use builder methods to set optional fields.
    #[must_use]
    pub fn new<T0: Into<crate::types::ChatIdKind>, T1: Into<i64>, T2: Into<u16>>(
        chat_id: T0,
        subscription_period: T1,
        subscription_price: T2,
    ) -> Self {
        Self {
            chat_id: chat_id.into(),
            name: None,
            subscription_period: subscription_period.into(),
            subscription_price: subscription_price.into(),
        }
    }

    /// Unique identifier for the target channel chat or username of the target channel in the format @username
    #[must_use]
    pub fn chat_id<T: Into<crate::types::ChatIdKind>>(mut self, val: T) -> Self {
        self.chat_id = val.into();
        self
    }

    /// Invite link name; 0-32 characters
    #[must_use]
    pub fn name<T: Into<Box<str>>>(mut self, val: T) -> Self {
        self.name = Some(val.into());
        self
    }

    /// Invite link name; 0-32 characters
    #[must_use]
    pub fn name_option<T: Into<Box<str>>>(mut self, val: Option<T>) -> Self {
        self.name = val.map(Into::into);
        self
    }

    /// The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
    #[must_use]
    pub fn subscription_period<T: Into<i64>>(mut self, val: T) -> Self {
        self.subscription_period = val.into();
        self
    }

    /// The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000
    #[must_use]
    pub fn subscription_price<T: Into<u16>>(mut self, val: T) -> Self {
        self.subscription_price = val.into();
        self
    }
}
impl super::TelegramMethod for CreateChatSubscriptionInviteLink {
    type Method = Self;
    type Return = crate::types::ChatInviteLink;

    fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
        super::Request::new("createChatSubscriptionInviteLink", self, None)
    }
}
