//! Client configuration.

use std::net::SocketAddr;
use std::path::PathBuf;

/// Configuration for a `QpqClient` instance.
#[derive(Debug, Clone)]
pub struct ClientConfig {
    /// Server address (host:port).
    pub server_addr: SocketAddr,

    /// Server hostname for TLS SNI.
    pub server_name: String,

    /// Path to the local conversation database.
    pub db_path: PathBuf,

    /// Password for encrypting the local database (SQLCipher).
    /// If `None`, the database is stored unencrypted.
    pub db_password: Option<String>,

    /// Path to the local state file (identity key, MLS state).
    pub state_path: PathBuf,

    /// Whether to accept self-signed TLS certificates (dev mode only).
    pub accept_invalid_certs: bool,

    /// ALPN protocol identifier for the RPC service.
    pub alpn: Vec<u8>,
}

impl Default for ClientConfig {
    fn default() -> Self {
        Self {
            server_addr: std::net::SocketAddr::new(
                std::net::IpAddr::V4(std::net::Ipv4Addr::new(127, 0, 0, 1)),
                7000,
            ),
            server_name: "localhost".to_string(),
            db_path: PathBuf::from("conversations.db"),
            db_password: None,
            state_path: PathBuf::from("client-state.bin"),
            accept_invalid_certs: false,
            alpn: b"qpq/2".to_vec(),
        }
    }
}
