using ZB.MOM.WW.OtOpcUa.Core.Abstractions;
namespace ZB.MOM.WW.OtOpcUa.Driver.Sql.Contracts;
///
/// The DriverConfig blob shape for a Sql driver instance (design §5.1). Deserialised by the
/// driver factory, which applies the documented defaults for every absent (null) field and maps the result
/// onto the driver's typed options.
/// No connection string lives here. Only — a name resolved at
/// Initialize from the environment / secret store (e.g. Sql__ConnectionStrings__MesStaging) — so a
/// deployed artifact never carries database credentials.
/// Enum-valued fields are enum-typed (not strings) so a JsonStringEnumConverter round-trips
/// their names rather than their ordinals. The converter is applied by the factory's
/// JsonSerializerOptions (Task 9), not by an attribute on this DTO — mirroring the driver
/// enum-serialization trap that bit the AdminUI driver pages.
///
public sealed class SqlDriverConfigDto
{
/// Which ADO.NET provider/dialect backs this instance. Defaults to — the only provider v1 constructs.
public SqlProvider Provider { get; init; } = SqlProvider.SqlServer;
///
/// Name of the connection string to resolve from the environment / secret store at Initialize —
/// never the connection string itself.
///
public string? ConnectionStringRef { get; init; }
/// Poll interval applied to groups that do not carry their own. Absent ⇒ the factory default.
public TimeSpan? DefaultPollInterval { get; init; }
///
/// Per-query wall-clock deadline enforced client-side (a breach surfaces BadTimeout). Must be
/// greater than , which is only the server-side backstop (design §8.3).
///
public TimeSpan? OperationTimeout { get; init; }
/// ADO.NET CommandTimeout backstop (seconds granularity server-side).
public TimeSpan? CommandTimeout { get; init; }
/// Cap on concurrently executing group queries — the connection-pool guard.
public int? MaxConcurrentGroups { get; init; }
/// When , a NULL cell publishes Bad rather than the default Uncertain.
public bool? NullIsBad { get; init; }
///
/// Master write kill-switch. v1 is read-only and this field is inert — the driver does not
/// implement IWritable, so no value here can produce a write. The factory warns when it
/// is authored rather than failing the driver, since the flag cannot do harm but
/// an operator who believes writes are enabled can.
///
public bool? AllowWrites { get; init; }
///
/// The authored raw tags the deploy artifact delivers for this driver instance — RawPath identity plus
/// the driver TagConfig blob, the same shape every other driver receives. The factory copies
/// these onto the driver's options and the driver maps each through
/// at Initialize.
/// A SQL source has no tag-discovery protocol, so this list is the complete set of tags the
/// instance serves — an absent or empty list is a driver with nothing to poll, not a driver that will
/// find its tags later.
///
public List? RawTags { get; init; }
}