namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
/// One driver instance in a cluster's generation. JSON config is schemaless per-driver-type.
public sealed class DriverInstance
{
public Guid DriverInstanceRowId { get; set; }
public long GenerationId { get; set; }
public required string DriverInstanceId { get; set; }
public required string ClusterId { get; set; }
///
/// Logical FK to . Same-cluster binding enforced by
/// sp_ValidateDraft per decision #122: Namespace.ClusterId must equal DriverInstance.ClusterId.
///
public required string NamespaceId { get; set; }
public required string Name { get; set; }
/// Galaxy | ModbusTcp | AbCip | AbLegacy | S7 | TwinCat | Focas | OpcUaClient
public required string DriverType { get; set; }
public bool Enabled { get; set; } = true;
/// Schemaless per-driver-type JSON config. Validated against registered JSON schema at draft-publish time (decision #91).
public required string DriverConfig { get; set; }
///
/// Optional per-instance overrides for the Phase 6.1 shared Polly resilience pipeline.
/// Null = use the driver's tier defaults (decision #143). When populated, expected shape:
///
/// {
/// "bulkheadMaxConcurrent": 16,
/// "bulkheadMaxQueue": 64,
/// "capabilityPolicies": {
/// "Read": { "timeoutSeconds": 5, "retryCount": 5, "breakerFailureThreshold": 3 },
/// "Write": { "timeoutSeconds": 5, "retryCount": 0, "breakerFailureThreshold": 5 }
/// }
/// }
///
/// Parsed at startup by DriverResilienceOptionsParser; every key is optional +
/// unrecognised keys are ignored so future shapes land without a migration.
///
public string? ResilienceConfig { get; set; }
public ConfigGeneration? Generation { get; set; }
public ServerCluster? Cluster { get; set; }
}