import Foundation

/// How sync bytes move between the Mac and a phone (SYNC_PROTOCOL §3) — the transport named
/// in a pairing QR and remembered by the phone for reconnects. Everything above it (Noise,
/// frames, messages) is identical across cases.
///
/// On the wire this travels as its raw string inside optional fields, so unknown future
/// values degrade to "unsupported", not decode failures.
public enum SyncTransportHint: String, Sendable, Codable, CaseIterable {
    /// Same-network TCP, discovered over Bonjour or an explicit QR host:port hint.
    case lan
    /// The user's tailnet: both devices run an embedded tsnet node (NucleicTailnet) and the
    /// phone dials the Mac's tailnet IP. Works from anywhere the tailnet reaches.
    case tailnet
    /// The Nucleic Private Relay (SYNC_PROTOCOL §3.2): a Cloudflare Worker room the host and
    /// its devices all dial out to (`RelayFrameChannel` / the host's room listener). The
    /// zero-config fallback when no direct path exists; E2EE-opaque to the relay.
    case relay

    /// Short user-facing name ("Connected · LAN", the Settings picker, …).
    public var label: String {
        switch self {
        case .lan: "LAN"
        case .tailnet: "Tailnet"
        case .relay: "Relay"
        }
    }
}
