namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Abstraction over the process-wide driver registry. Runtime consumes this instead of
/// DriverFactoryRegistry directly so the Runtime project doesn't pull in
/// ZB.MOM.WW.OtOpcUa.Core (which would drag in Polly + driver hosting). The fused
/// Host binds a DriverFactoryRegistryAdapter after every Driver.*.Register()
/// extension has run.
///
public interface IDriverFactory
{
///
/// Return a new for the given , or
/// null when no factory is registered for that type (missing assembly, typo, etc.).
/// The DriverHostActor logs + skips the row rather than failing the whole apply.
///
IDriver? TryCreate(string driverType, string driverInstanceId, string driverConfigJson);
/// Driver-type names this factory can materialise. Mostly for diagnostics + logs.
IReadOnlyCollection SupportedTypes { get; }
}
///
/// Returns null from every call. Bound when the
/// fused Host hasn't registered any concrete driver assemblies yet (Mac dev path, smoke
/// tests). DriverHostActor sees zero supported types and treats the deployment as a no-op.
///
public sealed class NullDriverFactory : IDriverFactory
{
public static readonly NullDriverFactory Instance = new();
private NullDriverFactory() { }
public IDriver? TryCreate(string driverType, string driverInstanceId, string driverConfigJson) => null;
public IReadOnlyCollection SupportedTypes { get; } = Array.Empty();
}