<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="using:DodoSSH.Client.Shell.ViewModels"
             x:Class="DodoSSH.Client.App.Views.SessionStatusBar"
             x:Name="Root"
             x:DataType="vm:MainWindowViewModel">

  <!--
    ── v5b's session shell status bar ───────────────────────────────────────────────────────────────────────
    37px, DeepChrome, a 1px top border — the foot of the bordered container both the terminal and the SFTP
    surface share. The design's own row also carries a negotiated cipher and a host-key-plus-identity run
    (`ed25519 · acme-deploy-key`, clickable to a pin-details modal); both are now real and bound, plumbed all
    the way from SSH.NET through TerminalWorkspace.GetSessionFacts and TransfersViewModel to
    MainWindowViewModel's own surface-aware properties — see SessionCipher, SessionHostKeyAlgorithm,
    SessionIdentityLabel and the composed SessionIdentityText.

    Three honest deviations from the mock. The algorithm prints exactly as negotiated — "ssh-ed25519", not
    the design's shortened "ed25519" — because trimming it would be a cosmetic edit to a string this client
    did not choose. The run is plain text, not a button: this application has no pin-details modal for a
    session that is already open, and drawing a click target for a screen that does not exist would be the
    fabrication this project's honesty rule forbids, not an honest omission of one. And a typed-password
    session — nothing filed in the keychain to name — shows the algorithm alone, with no " · " after it,
    because there is no item behind the dot.

    What is real and bound: the CONNECTED word and dot, off IsSessionConnected, shown only while there is a
    session/host context to report on at all — SessionAddress null means nothing here has anything to say,
    the same state the header answers with its own empty-state sentence; the cipher and the host-key/identity
    run, each collapsed rather than shown empty or fabricated when the fact behind it is not there — a bucket
    connection has neither, and a session whose facts could not be read back at the instant they were asked
    for has neither either; the elapsed timer, off SessionElapsedText, which is null and therefore absent
    whenever there is nothing timed; and, only on the terminal surface — see <see cref="ShowsEncoding"/> —
    "UTF-8", which is a true fact about this client's own renderer and write path (see TerminalWorkspace's
    terminal.js and SshShellSessionExtensions.WriteTextAsync) rather than a negotiated session parameter, and
    is worded plainly rather than as a claim the remote agreed to it.
  -->

  <Border Height="37" Background="{StaticResource DeepChrome}"
          BorderBrush="{StaticResource Border}" BorderThickness="0,1,0,0">
    <Grid ColumnDefinitions="*,Auto" Margin="24,0">

      <StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="18" VerticalAlignment="Center">
        <StackPanel Orientation="Horizontal" Spacing="7" VerticalAlignment="Center"
                    IsVisible="{Binding SessionAddress, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
          <Ellipse Classes="dot" Width="7" Height="7" Classes.live="{Binding IsSessionConnected}"
                   VerticalAlignment="Center" />

          <TextBlock FontFamily="Montserrat" FontWeight="SemiBold" FontSize="9.5" LetterSpacing="1.2"
                     VerticalAlignment="Center" Text="CONNECTED" Foreground="{StaticResource Live}"
                     IsVisible="{Binding IsSessionConnected}" />
          <TextBlock FontFamily="Montserrat" FontWeight="SemiBold" FontSize="9.5" LetterSpacing="1.2"
                     VerticalAlignment="Center" Text="NOT CONNECTED" Foreground="{StaticResource TextFaint}"
                     IsVisible="{Binding !IsSessionConnected}" />
        </StackPanel>

        <TextBlock Classes="mono" FontSize="11.5" Foreground="{StaticResource TextGhost}"
                   VerticalAlignment="Center" Text="{Binding SessionCipher}"
                   IsVisible="{Binding SessionCipher, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
        <TextBlock Classes="mono" FontSize="11.5" Foreground="{StaticResource TextGhost}"
                   VerticalAlignment="Center" Text="{Binding SessionIdentityText}"
                   IsVisible="{Binding SessionIdentityText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
      </StackPanel>

      <StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="18" VerticalAlignment="Center">
        <TextBlock Classes="mono" FontSize="11.5" Foreground="{StaticResource TextGhost}"
                   VerticalAlignment="Center" Text="{Binding SessionElapsedText}"
                   IsVisible="{Binding SessionElapsedText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
        <TextBlock Classes="mono" FontSize="11.5" Foreground="{StaticResource TextGhost}"
                   VerticalAlignment="Center" Text="UTF-8"
                   IsVisible="{Binding #Root.ShowsEncoding}" />
      </StackPanel>

    </Grid>
  </Border>

</UserControl>
