using ZB.MOM.WW.Audit; namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.InboundApi; /// /// Request routed from Inbound API to a site to invoke a script on an instance. /// Used by Route.To("instanceCode").Call("scriptName", params). /// /// /// ParentExecutionId: the spawning execution's ExecutionId /// — for an inbound-API-routed call this is the inbound request's per-request /// execution id. The site records it as the routed script execution's /// ParentExecutionId so a spawned execution points back at its spawner. /// Additive trailing member — null for requests built before the field existed /// or for routed calls with no spawning execution (e.g. the Central UI sandbox). /// /// Flow Debugger trace flag — see design 2026-09-05 §5.2. Additive; defaults to untraced. public record RouteToCallRequest( string CorrelationId, string InstanceUniqueName, string ScriptName, IReadOnlyDictionary? Parameters, DateTimeOffset Timestamp, Guid? ParentExecutionId = null, bool Trace = false); /// /// Response from a Route.To() call. /// /// Flow Debugger — the routed site run's ExecutionId (design 2026-09-05 §5.4); null from a site that predates the field. /// Flow Debugger — the site's ScriptTrace audit events for a traced run, in emission order (design 2026-09-05 §5.4); null when untraced or from an older site. public record RouteToCallResponse( string CorrelationId, bool Success, object? ReturnValue, string? ErrorMessage, DateTimeOffset Timestamp, Guid? ChildExecutionId = null, IReadOnlyList? TraceEvents = null); /// /// Request to read attribute(s) from a remote instance. /// /// /// ParentExecutionId: mirrors . /// For an inbound-API-routed read this is the inbound request's per-request execution id; /// future site-side audit emission for routed reads can stamp it as ParentExecutionId /// so the inbound→site execution-tree link survives the read path. Additive trailing /// member — null for the Central UI sandbox path or for callers built before the field existed. /// public record RouteToGetAttributesRequest( string CorrelationId, string InstanceUniqueName, IReadOnlyList AttributeNames, DateTimeOffset Timestamp, Guid? ParentExecutionId = null); /// /// Response containing attribute values from a remote instance. /// public record RouteToGetAttributesResponse( string CorrelationId, IReadOnlyDictionary Values, bool Success, string? ErrorMessage, DateTimeOffset Timestamp); /// /// Request to write attribute(s) on a remote instance. /// /// /// ParentExecutionId: mirrors . /// For an inbound-API-routed write this is the inbound request's per-request execution id; /// site-side audit emission for the underlying device / static-attribute write can stamp /// it as ParentExecutionId so the inbound→site execution-tree link survives the /// write path. Additive trailing member — null for the Central UI sandbox path or for /// callers built before the field existed. /// /// Flow Debugger trace flag — see design 2026-09-05 §5.2. Additive; defaults to untraced. public record RouteToSetAttributesRequest( string CorrelationId, string InstanceUniqueName, IReadOnlyDictionary AttributeValues, DateTimeOffset Timestamp, Guid? ParentExecutionId = null, bool Trace = false); /// /// Response confirming attribute writes on a remote instance. /// public record RouteToSetAttributesResponse( string CorrelationId, bool Success, string? ErrorMessage, DateTimeOffset Timestamp); /// /// Request to block until a remote instance attribute reaches a target value /// (spec §6 — Route.To("inst").WaitForAttribute(name, targetValue, timeout)). /// Value-equality across the wire: carries the /// canonical AttributeValueCodec-encoded target; there is no predicate (a /// cross-process lambda cannot be routed). optionally /// gates the match on Good quality. The site evaluates the match and either matches or /// times out. /// /// /// ParentExecutionId: mirrors . /// For an inbound-API-routed wait this is the inbound request's per-request execution id; /// future site-side audit emission for routed waits can stamp it as ParentExecutionId /// so the inbound→site execution-tree link survives the wait path. Additive trailing /// member — null for the Central UI sandbox path or for callers built before the field existed. /// /// /// Quality-gated ("Good"-only) mode (spec §4.2): when true, a value reaching the target at /// Bad/Uncertain quality is NOT a match — the site holds the wait until the value satisfies /// the target at Good quality (or times out). Additive trailing member; defaults to /// (quality-agnostic) so older callers and the wire default are unchanged. /// public record RouteToWaitForAttributeRequest( string CorrelationId, string InstanceUniqueName, string AttributeName, string? TargetValueEncoded, TimeSpan Timeout, DateTimeOffset Timestamp, Guid? ParentExecutionId = null, bool RequireGoodQuality = false); /// /// Response from a remote attribute wait. / /// convey the routing-level outcome (e.g. instance-not-found); , /// , , and convey the wait /// outcome itself. When is true, exactly one of /// / holds: means the /// attribute reached the target value (with / /// captured at the match), means the deadline elapsed first. /// public record RouteToWaitForAttributeResponse( string CorrelationId, bool Matched, object? Value, string? Quality, bool TimedOut, bool Success, string? ErrorMessage, DateTimeOffset Timestamp);