namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Instance;
///
/// Request to write a SET of data-sourced attributes on one instance to the device in a
/// single DCL batch round-trip, optionally followed by a trigger-flag attribute write.
/// The Instance Actor resolves each attribute's data binding (connection + device tag
/// path), decodes List values, enforces single-connection scope, and forwards one
/// WriteTagBatchRequest to the DCL. This is the write half of the script-facing
/// Attributes.WriteBatchAndWaitAsync helper; the wait half reuses the existing
/// event-driven WaitForAttribute waiter.
///
///
/// Site-local only. Values are carried codec-ENCODED (strings), so this message
/// would serialize — but the helper composing it issues the wait via the in-process
/// predicate-capable WaitForAttribute path, so the whole flow stays within one
/// site node's actor system (script execution → Instance Actor → DCL).
///
///
/// Per-write correlation id; echoed on the response.
/// The instance whose attributes are written.
/// Canonical (scope-resolved) attribute name → codec-encoded value.
/// Optional canonical attribute name of a flag written AFTER the batch; null to skip.
/// Codec-encoded value for .
/// When the request was issued (UTC).
public record WriteAttributeBatchRequest(
string CorrelationId,
string InstanceName,
IReadOnlyDictionary AttributeEncodedValues, // canonical attr name -> codec-encoded value
string? TriggerAttribute,
string? TriggerEncodedValue,
DateTimeOffset OccurredAtUtc);
///
/// Reply to a . is true only
/// when the DCL batch (and trigger, if any) all committed.
///
/// Echoes the request's correlation id.
/// True when the batch (and trigger, if any) all committed at the device.
/// Non-null on failure — an unresolved/non-data-sourced attribute, a multi-connection batch, a list-decode failure, or the DCL error/timeout.
public record WriteAttributeBatchResponse(
string CorrelationId,
bool Success,
string? ErrorMessage);