// Copyright (c) Microsoft. All rights reserved.
namespace Microsoft.Agents.AI.Workflows.Declarative.Kit;
///
/// Message sent to initiate a transition to another .
///
public sealed record class ActionExecutorResult
{
///
/// The identifier of the that produced this message.
///
public string ExecutorId { get; }
///
/// The result of the action, if any provided.
///
public object? Result { get; }
internal ActionExecutorResult(string executorId, object? result = null)
{
this.ExecutorId = executorId;
this.Result = result;
}
internal static ActionExecutorResult ThrowIfNot(object? message)
{
if (message is not ActionExecutorResult executorMessage)
{
throw new DeclarativeActionException($"Unexpected message type: {message?.GetType().Name ?? "(null)"} (Expected: {nameof(ActionExecutorResult)})");
}
return executorMessage;
}
}