// Auto-generated by crates/tele-codegen. Do not edit manually.
use serde::Serialize;
use serde_json::Value;

use crate::Result;

use crate::types::validation::{
    positive_i64 as validate_positive_i64, required_string as validate_required_string,
    string_id as validate_string_id,
};

use super::AdvancedRequest;

/// Auto-generated request for `getForumTopicIconStickers`.
#[derive(Clone, Debug, Default, Serialize)]
pub struct AdvancedGetForumTopicIconStickersRequest {}

impl AdvancedGetForumTopicIconStickersRequest {
    pub fn new() -> Self {
        Self {}
    }
}

impl AdvancedRequest for AdvancedGetForumTopicIconStickersRequest {
    type Response = Vec<crate::types::sticker::Sticker>;
    const METHOD: &'static str = "getForumTopicIconStickers";
}

/// Auto-generated request for `createForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedCreateForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
    pub name: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub icon_color: Option<i64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub icon_custom_emoji_id: Option<String>,
}

impl AdvancedCreateForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>, name: impl Into<String>) -> Self {
        Self {
            chat_id: chat_id.into(),
            name: name.into(),
            icon_color: None,
            icon_custom_emoji_id: None,
        }
    }
}

impl AdvancedRequest for AdvancedCreateForumTopicRequest {
    type Response = Value;
    const METHOD: &'static str = "createForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        validate_required_string("name", &self.name)?;
        if let Some(value) = self.icon_custom_emoji_id.as_deref() {
            validate_string_id("icon_custom_emoji_id", value)?;
        }
        Ok(())
    }
}

/// Auto-generated request for `editForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedEditForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
    pub message_thread_id: i64,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub icon_custom_emoji_id: Option<String>,
}

impl AdvancedEditForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
        Self {
            chat_id: chat_id.into(),
            message_thread_id,
            name: None,
            icon_custom_emoji_id: None,
        }
    }
}

impl AdvancedRequest for AdvancedEditForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "editForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        validate_positive_i64("message_thread_id", self.message_thread_id)?;
        if let Some(value) = self.icon_custom_emoji_id.as_deref() {
            validate_string_id("icon_custom_emoji_id", value)?;
        }
        Ok(())
    }
}

/// Auto-generated request for `closeForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedCloseForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
    pub message_thread_id: i64,
}

impl AdvancedCloseForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
        Self {
            chat_id: chat_id.into(),
            message_thread_id,
        }
    }
}

impl AdvancedRequest for AdvancedCloseForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "closeForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        validate_positive_i64("message_thread_id", self.message_thread_id)?;
        Ok(())
    }
}

/// Auto-generated request for `reopenForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedReopenForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
    pub message_thread_id: i64,
}

impl AdvancedReopenForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
        Self {
            chat_id: chat_id.into(),
            message_thread_id,
        }
    }
}

impl AdvancedRequest for AdvancedReopenForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "reopenForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        validate_positive_i64("message_thread_id", self.message_thread_id)?;
        Ok(())
    }
}

/// Auto-generated request for `deleteForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedDeleteForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
    pub message_thread_id: i64,
}

impl AdvancedDeleteForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
        Self {
            chat_id: chat_id.into(),
            message_thread_id,
        }
    }
}

impl AdvancedRequest for AdvancedDeleteForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "deleteForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        validate_positive_i64("message_thread_id", self.message_thread_id)?;
        Ok(())
    }
}

/// Auto-generated request for `unpinAllForumTopicMessages`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedUnpinAllForumTopicMessagesRequest {
    pub chat_id: crate::types::common::ChatId,
    pub message_thread_id: i64,
}

impl AdvancedUnpinAllForumTopicMessagesRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>, message_thread_id: i64) -> Self {
        Self {
            chat_id: chat_id.into(),
            message_thread_id,
        }
    }
}

impl AdvancedRequest for AdvancedUnpinAllForumTopicMessagesRequest {
    type Response = bool;
    const METHOD: &'static str = "unpinAllForumTopicMessages";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        validate_positive_i64("message_thread_id", self.message_thread_id)?;
        Ok(())
    }
}

/// Auto-generated request for `editGeneralForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedEditGeneralForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
    pub name: String,
}

impl AdvancedEditGeneralForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>, name: impl Into<String>) -> Self {
        Self {
            chat_id: chat_id.into(),
            name: name.into(),
        }
    }
}

impl AdvancedRequest for AdvancedEditGeneralForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "editGeneralForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        validate_required_string("name", &self.name)?;
        Ok(())
    }
}

/// Auto-generated request for `closeGeneralForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedCloseGeneralForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
}

impl AdvancedCloseGeneralForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
        Self {
            chat_id: chat_id.into(),
        }
    }
}

impl AdvancedRequest for AdvancedCloseGeneralForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "closeGeneralForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        Ok(())
    }
}

/// Auto-generated request for `reopenGeneralForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedReopenGeneralForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
}

impl AdvancedReopenGeneralForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
        Self {
            chat_id: chat_id.into(),
        }
    }
}

impl AdvancedRequest for AdvancedReopenGeneralForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "reopenGeneralForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        Ok(())
    }
}

/// Auto-generated request for `hideGeneralForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedHideGeneralForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
}

impl AdvancedHideGeneralForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
        Self {
            chat_id: chat_id.into(),
        }
    }
}

impl AdvancedRequest for AdvancedHideGeneralForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "hideGeneralForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        Ok(())
    }
}

/// Auto-generated request for `unhideGeneralForumTopic`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedUnhideGeneralForumTopicRequest {
    pub chat_id: crate::types::common::ChatId,
}

impl AdvancedUnhideGeneralForumTopicRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
        Self {
            chat_id: chat_id.into(),
        }
    }
}

impl AdvancedRequest for AdvancedUnhideGeneralForumTopicRequest {
    type Response = bool;
    const METHOD: &'static str = "unhideGeneralForumTopic";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        Ok(())
    }
}

/// Auto-generated request for `unpinAllGeneralForumTopicMessages`.
#[derive(Clone, Debug, Serialize)]
pub struct AdvancedUnpinAllGeneralForumTopicMessagesRequest {
    pub chat_id: crate::types::common::ChatId,
}

impl AdvancedUnpinAllGeneralForumTopicMessagesRequest {
    pub fn new(chat_id: impl Into<crate::types::common::ChatId>) -> Self {
        Self {
            chat_id: chat_id.into(),
        }
    }
}

impl AdvancedRequest for AdvancedUnpinAllGeneralForumTopicMessagesRequest {
    type Response = bool;
    const METHOD: &'static str = "unpinAllGeneralForumTopicMessages";

    fn validate(&self) -> Result<()> {
        self.chat_id.validate()?;
        Ok(())
    }
}
