use serde::{Deserialize, Serialize};

/// Request to add a custom domain
#[derive(Debug, Deserialize)]
pub struct AddCustomDomainRequest {
    pub domain: String,
}

/// API response for a single custom domain
#[derive(Debug, Serialize)]
pub struct CustomDomainResponse {
    pub id: String,
    pub domain: String,
    pub is_primary: bool,
    pub created_at: String,
    pub updated_at: String,
}

impl CustomDomainResponse {
    /// Create response from database model
    pub fn from_db_model(domain: &crate::db::models::CustomDomain) -> Self {
        Self {
            id: domain.id.to_string(),
            domain: domain.domain.clone(),
            is_primary: domain.is_primary,
            created_at: domain.created_at.to_rfc3339(),
            updated_at: domain.updated_at.to_rfc3339(),
        }
    }
}

/// Response containing multiple custom domains
#[derive(Debug, Serialize)]
pub struct CustomDomainsResponse {
    pub domains: Vec<CustomDomainResponse>,
}
