/// Represents a Nostr relay connection. class NostrRelay { /// Relay URL (e.g., 'wss://relay.example.com'). final String url; /// Whether the relay is currently connected. bool isConnected; /// Whether the relay is enabled (should be used). bool isEnabled; /// Number of consecutive connection failures. int retryCount; /// Maximum number of retry attempts before disabling. static const int maxRetryAttempts = 3; /// Creates a [NostrRelay] instance. NostrRelay({ required this.url, this.isConnected = false, this.isEnabled = true, this.retryCount = 0, }); /// Creates a [NostrRelay] from a URL string. factory NostrRelay.fromUrl(String url) { return NostrRelay(url: url); } @override String toString() { return 'NostrRelay(url: $url, connected: $isConnected, enabled: $isEnabled, retryCount: $retryCount)'; } @override bool operator ==(Object other) { if (identical(this, other)) return true; return other is NostrRelay && other.url == url; } @override int get hashCode => url.hashCode; }