namespace DodoSSH.Client.Domain.Tests;

/// <summary>Builds hosts for the suites, so each test varies only what it is about.</summary>
internal static class HostFactory
{
    internal static Guid Bastion { get; } = Guid.Parse("0192f0c8-1111-7c3d-8e4f-5a6b7c8d9e01");

    internal static Guid Relay { get; } = Guid.Parse("0192f0c8-2222-7c3d-8e4f-5a6b7c8d9e02");

    /// <summary>A vault SSH key id, for the hosts that bind one.</summary>
    internal static Guid DeployKey { get; } = Guid.Parse("0192f0c8-3333-7c3d-8e4f-5a6b7c8d9e03");

    /// <summary>A group id, for the hosts that are filed under one.</summary>
    internal static Guid Production { get; } = Guid.Parse("0192f0c8-4444-7c3d-8e4f-5a6b7c8d9e04");

    internal static HostSecret Host(
        string label = "prod-db",
        string hostname = "db.internal",
        int port = 22,
        string? username = "deploy",
        string? notes = null,
        Guid[]? jumps = null,
        (string Name, string Value)[]? options = null,
        bool relayEnabled = false,
        Guid? sshKeyId = null,
        Guid? credentialId = null,
        Guid? groupId = null) =>
        new()
        {
            Label = label,
            Hostname = hostname,
            Port = port,
            Username = username,
            Notes = notes,
            JumpHostIds = jumps is null ? JumpChain.Empty : JumpChain.Create(jumps),
            Options = options is null
                ? HostOptions.Empty
                : HostOptions.Create(options.Select(o => new HostOption(o.Name, o.Value))),
            RelayEnabled = relayEnabled,
            SshKeyId = sshKeyId,
            CredentialId = credentialId,
            GroupId = groupId,
        };
}
