use serde::Deserialize;
use validator::Validate;

/// 创建临时邮箱请求
#[derive(Deserialize, Validate)]
pub struct CreateMailboxRequest {
    /// 自定义本地部分（不传则随机生成）
    #[validate(length(min = 1, max = 64))]
    pub local_part: Option<String>,
    /// 自定义域名（不传则用配置的第一个 local_domain）
    #[validate(length(min = 1, max = 255))]
    pub domain: Option<String>,
    /// 用途备注
    #[validate(length(max = 128))]
    pub note: Option<String>,
    /// 自定义有效期（小时），不传则用配置默认
    pub ttl_hours: Option<i64>,
}

impl std::fmt::Debug for CreateMailboxRequest {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("CreateMailboxRequest")
            .field("local_part", &self.local_part)
            .field("domain", &self.domain)
            .field("note", &self.note)
            .field("ttl_hours", &self.ttl_hours)
            .finish()
    }
}
