using Avalonia.Controls;
using Avalonia.Input;

namespace DodoSSH.Client.App.Views;

/// <summary>
/// The host keys this keychain has approved.
/// </summary>
/// <remarks>
/// Its data context is a <c>KnownHostsViewModel</c>, which is a screen-scoped wrapper over the vault rather
/// than an owner of anything: the pins, the reload and the withdrawal all still belong to
/// <c>VaultViewModel</c>. See that class for why.
/// </remarks>
internal sealed partial class KnownHostsScreen : UserControl
{
    public KnownHostsScreen() => InitializeComponent();

    /// <summary>Where the keyboard lands when this screen is the one showing.</summary>
    /// <remarks>
    /// The filter box rather than the list, unlike the keychain screen. This screen is reached to answer a
    /// question — is this fingerprint one of mine — and the first thing anybody does is type part of it.
    /// The box is also always there, where the list is empty on a fresh keychain, and <c>Focus()</c> on a
    /// collapsed control is a no-op that is not replayed.
    /// </remarks>
    internal IInputElement KeyboardTarget => PinFilter;
}
