// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
namespace Microsoft.Agents.AI.Workflows;
///
/// Base class for -scoped events.
///
[JsonDerivedType(typeof(ExecutorInvokedEvent))]
[JsonDerivedType(typeof(ExecutorCompletedEvent))]
[JsonDerivedType(typeof(ExecutorFailedEvent))]
public class ExecutorEvent(string executorId, object? data) : WorkflowEvent(data)
{
///
/// The identifier of the executor that generated this event.
///
public string ExecutorId => executorId;
///
public override string ToString() =>
this.Data is not null ?
$"{this.GetType().Name}(Executor = {this.ExecutorId}, Data: {this.Data.GetType()} = {this.Data})" :
$"{this.GetType().Name}(Executor = {this.ExecutorId})";
}