namespace DodoSSH.Client.Import;

/// <summary>One <c>Keyword Value</c> line, with the keyword as written.</summary>
/// <param name="Keyword">The directive name. SSH keywords are case-insensitive; the case here is the file's.</param>
/// <param name="Value">Everything after the keyword, unquoted but otherwise verbatim.</param>
public sealed record SshConfigDirective(string Keyword, string Value);

/// <summary>
/// One <c>Host</c> block: the patterns it applies to and the directives under it.
/// </summary>
/// <param name="Patterns">
/// Every token on the <c>Host</c> line. One line can name several — <c>Host web1 web2 web3</c> — and any of
/// them may be a pattern rather than a name.
/// </param>
/// <param name="Directives">The directives under it, in file order.</param>
public sealed record SshConfigBlock(
    IReadOnlyList<string> Patterns,
    IReadOnlyList<SshConfigDirective> Directives);

/// <summary>
/// A parsed <c>ssh_config</c>, plus what could not be honoured.
/// </summary>
/// <param name="Blocks">Every <c>Host</c> block, in the order OpenSSH would read them.</param>
/// <param name="Warnings">
/// What was skipped or flattened, in the words the preview will show. Everything this parser cannot
/// represent ends up here rather than being dropped quietly — a config that half-imported without saying so
/// is worse than one that refused.
/// </param>
public sealed record SshConfigDocument(
    IReadOnlyList<SshConfigBlock> Blocks,
    IReadOnlyList<string> Warnings);
