using Microsoft.Extensions.Options;
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
namespace ZB.MOM.WW.ScadaBridge.Host;
///
/// Binds to .
/// Empty or whitespace values are normalised to null; otherwise the value
/// is returned trimmed.
///
internal sealed class NodeIdentityProvider : INodeIdentityProvider
{
///
public string? NodeName { get; }
///
/// Initializes a new from the given node options.
///
/// Node options whose is normalised.
public NodeIdentityProvider(IOptions nodeOptions)
{
var configured = nodeOptions.Value.NodeName;
NodeName = string.IsNullOrWhiteSpace(configured) ? null : configured.Trim();
}
}