use std::{collections::BTreeMap, time::Duration};

/// Kubernetes discovery adapter configuration.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct KubeDiscoveryConfig {
    /// Optional kubeconfig context name.
    pub context: Option<String>,
    /// Namespace to inspect.
    pub namespace: String,
    /// Optional service name to watch.
    pub service_name: Option<String>,
    /// Optional label selector.
    pub label_selector: Option<String>,
    /// Optional field selector.
    pub field_selector: Option<String>,
    /// Optional port name.
    pub port_name: Option<String>,
    /// Kubernetes watch timeout in seconds.
    pub watch_timeout: Option<u32>,
    /// Kubernetes list page size during watcher initialization.
    pub page_size: Option<u32>,
    /// Maximum time to wait for the first watcher synchronization.
    pub sync_timeout: Duration,
    /// Metadata propagated to instances.
    pub metadata: BTreeMap<String, String>,
}

impl Default for KubeDiscoveryConfig {
    fn default() -> Self {
        Self {
            context: None,
            namespace: "default".to_string(),
            service_name: None,
            label_selector: None,
            field_selector: None,
            port_name: None,
            watch_timeout: Some(290),
            page_size: Some(500),
            sync_timeout: Duration::from_secs(10),
            metadata: BTreeMap::new(),
        }
    }
}
