using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
using ZB.MOM.WW.OtOpcUa.Driver.Sql.Contracts;
namespace ZB.MOM.WW.OtOpcUa.Driver.Sql;
///
/// The typed form of a Sql driver instance's configuration — what
/// becomes once the factory has applied its defaults (design §5.1).
/// Mirrors ModbusDriverOptions: the driver instance is constructed with these, and its
/// serves them rather than re-parsing the config JSON.
/// No connection string here. The resolved connection string is a separate constructor
/// argument, because it is a secret and these options are safe to log, diff and hold in a snapshot.
///
public sealed class SqlDriverOptions
{
///
/// The authored raw tags this driver serves. The deploy artifact hands each authored raw Tag
/// as a (RawPath identity + driver TagConfig blob); the driver maps
/// each through into its RawPath → definition table.
/// A SQL source has no tag-discovery protocol — the driver serves exactly these.
///
public IReadOnlyList RawTags { get; init; } = [];
///
/// Poll interval used when a subscriber does not ask for one (design §4: defaultPollInterval,
/// default 5 s). A subscriber that names an interval gets that interval, floored by
/// .
///
public TimeSpan DefaultPollInterval { get; init; } = TimeSpan.FromSeconds(5);
///
/// The client-side wall-clock ceiling on one group query (design §8.3, default 15 s). A breach
/// publishes for that group's tags.
///
public TimeSpan OperationTimeout { get; init; } = TimeSpan.FromSeconds(15);
///
/// The ADO.NET CommandTimeout server-side backstop (default 10 s), also the bound on the
/// Initialize-time liveness check.
/// Authoring must keep strictly greater than this (design §8.3);
/// inverted, the client-side abort always fires first and masks the backstop. That rule is
/// enforced by config validation in the factory, not here — the reader deliberately stays usable
/// with the order inverted so the frozen-database tests can prove the client-side bound fires.
///
public TimeSpan CommandTimeout { get; init; } = TimeSpan.FromSeconds(10);
/// Cap on concurrently executing group queries — and therefore on concurrently open connections.
public int MaxConcurrentGroups { get; init; } = 4;
///
/// When , a present row whose value cell is NULL publishes
/// instead of the default .
/// It never governs an absent row, which is always .
///
public bool NullIsBad { get; init; }
}