namespace VoiceCat.App.Models;

public enum AuthMode
{
    Guest,
    Password,
}

/// <summary>One entry in the saved-server list (%AppData%\VoiceCat\servers.json).</summary>
public sealed class SavedServer
{
    public string DisplayName { get; set; } = "";
    public string Host { get; set; } = "";
    public ushort Port { get; set; } = 8384;
    public string LastNickname { get; set; } = "";
    public AuthMode AuthMode { get; set; } = AuthMode.Guest;
    public string? SavedUsername { get; set; }

    /// <summary>DPAPI-protected (CurrentUser scope), base64 — only set when the user opts in
    /// via the "Remember my password on this computer" checkbox. Never plaintext, never the
    /// default. See PasswordProtector.</summary>
    public string? ProtectedPasswordBase64 { get; set; }

    public override string ToString() =>
        string.IsNullOrWhiteSpace(DisplayName) ? $"{Host}:{Port}" : $"{DisplayName} ({Host}:{Port})";
}
