use crate::Url;
use confique::Config;
use std::{net::IpAddr, path::PathBuf};

#[derive(Config, Debug, Clone)]
#[allow(dead_code)]
pub struct GatewayConfig {
    /// Port to listen on.
    #[config(env = "PORT", default = 1965)]
    pub port: u16,

    /// Gemini Key path.
    pub key: Option<PathBuf>,

    /// Gemini Cert path.
    pub cert: Option<PathBuf>,

    /// Bind address.
    #[config(default = "127.0.0.1")]
    pub address: IpAddr,

    /// List of Nostr relays to connect to
    #[config(default = ["wss://nos.lol", "wss://relay.damus.io", "wss://nostr-pub.wellorder.net"])]
    pub relays: Vec<String>,
}

#[derive(Config, Debug, Clone)]
pub struct SiteConfig {
    /// List of Nostr relays
    #[config(default = ["wss://nos.lol", "wss://relay.damus.io", "wss://nostr-pub.wellorder.net"])]
    pub relays: Vec<Url>,

    /// List of Blossom servers to publish to
    #[config(default = ["https://cdn.hzrd149.com"])]
    pub servers: Vec<Url>,

    /// Site title
    #[config(default = "My ngemsite")]
    pub title: String,

    /// Site description
    #[config(default = "Description")]
    pub description: String,

    /// Source code location (repository link)
    pub source: Option<String>,

    /// Automatically convert .gmi documents to .html
    #[config(default = false)]
    pub auto_gemtext_to_html: bool,
}
