namespace ScadaLink.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).
///
///
/// Audit Log #23 (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).
///
public record RouteToCallRequest(
string CorrelationId,
string InstanceUniqueName,
string ScriptName,
IReadOnlyDictionary? Parameters,
DateTimeOffset Timestamp,
Guid? ParentExecutionId = null);
///
/// Response from a Route.To() call.
///
public record RouteToCallResponse(
string CorrelationId,
bool Success,
object? ReturnValue,
string? ErrorMessage,
DateTimeOffset Timestamp);
///
/// Request to read attribute(s) from a remote instance.
///
public record RouteToGetAttributesRequest(
string CorrelationId,
string InstanceUniqueName,
IReadOnlyList AttributeNames,
DateTimeOffset Timestamp);
///
/// 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.
///
public record RouteToSetAttributesRequest(
string CorrelationId,
string InstanceUniqueName,
IReadOnlyDictionary AttributeValues,
DateTimeOffset Timestamp);
///
/// Response confirming attribute writes on a remote instance.
///
public record RouteToSetAttributesResponse(
string CorrelationId,
bool Success,
string? ErrorMessage,
DateTimeOffset Timestamp);