import Foundation

enum AuthMode: String, Codable, CaseIterable {
    case guest
    case password
}

struct SavedServer: Codable, Identifiable {
    var id: UUID = UUID()
    var host: String
    var port: UInt16
    var authMode: AuthMode
    var savedUsername: String?
    /// Free-form display name used when connecting as a guest. Distinct from the account
    /// `savedUsername`. Empty/nil falls back to the system full name.
    var nickname: String?
    var keychainTag: String?

    var displayString: String {
        switch authMode {
        case .guest:
            return "\(host):\(port) (Guest)"
        case .password:
            return "\(savedUsername ?? "")@\(host):\(port)"
        }
    }
}
