use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::net::IpAddr;
use std::net::SocketAddr;
#[derive(Clone, Debug)]
pub enum DiscoveryEvent {
ServiceFound(DiscoveryServiceDetails),
ServiceLost(String),
DiscoveryStarted,
DiscoveryStopped,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum DiscoveryServiceStatus {
Stopped,
Running,
Stopping,
}
#[derive(Clone, Debug, Serialize, Deserialize, Hash, PartialEq, Eq)]
pub struct DiscoveryServiceDetails {
pub service_type: String,
pub instance_name: String,
pub domain_name: String,
pub host_name: Option<String>,
pub addresses: BTreeSet<IpAddr>,
pub socket_addresses: BTreeSet<SocketAddr>,
pub port: u16,
pub properties: BTreeMap<String, String>,
pub last_seen: Option<u64>,
}
#[derive(Clone, Debug)]
pub struct LocalServiceConfig {
pub service_type: String,
pub port: u16,
pub instance_name: String,
pub properties: Option<HashMap<String, String>>,
pub service_ttl: u64,
pub mdns_response_delay_ms: (u64, u64),
pub refresh_interval: u64,
}