using ZB.MOM.WW.Secrets.Abstractions;

namespace ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient;

/// <summary>
///     A null-object <see cref="ISecretResolver"/> that resolves every name to <c>null</c>
///     (absent). Backs the driver's default (test/parse-only) construction path so callers that
///     never author a <c>secret:</c> credential ref need not thread a real resolver. A production
///     <c>OpcUaClientDriver</c> always receives the DI-registered resolver via the factory; a
///     <c>secret:</c> ref resolved against this null object throws fail-closed (the secret is
///     reported absent), which is the correct behaviour for a mis-wired deployment — the
///     <c>secret:</c> literal is never sent verbatim as a password.
/// </summary>
internal sealed class NullSecretResolver : ISecretResolver
{
    /// <summary>The shared singleton instance.</summary>
    public static readonly NullSecretResolver Instance = new();

    private NullSecretResolver()
    {
    }

    /// <inheritdoc />
    public Task<string?> GetAsync(SecretName name, CancellationToken ct) =>
        Task.FromResult<string?>(null);
}
