// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Agents.AI.Workflows.Reflection;
///
/// A message handler interface for handling messages of type .
///
///
///
/// This interface is obsolete. Use the on methods in a partial class
/// deriving from instead.
///
[Obsolete("Use [MessageHandler] attribute on methods in a partial class deriving from Executor. " +
"This interface will be removed in a future version.")]
public interface IMessageHandler
{
///
/// Handles the incoming message asynchronously.
///
/// The message to handle.
/// The execution context.
/// The to monitor for cancellation requests.
/// The default is .
/// A task that represents the asynchronous operation.
ValueTask HandleAsync(TMessage message, IWorkflowContext context, CancellationToken cancellationToken = default);
}
///
/// A message handler interface for handling messages of type and
/// returning a result.
///
/// The type of message to handle.
/// The type of result returned after handling the message.
///
/// This interface is obsolete. Use the on methods in a partial class
/// deriving from instead.
///
[Obsolete("Use [MessageHandler] attribute on methods in a partial class deriving from Executor. " +
"This interface will be removed in a future version.")]
public interface IMessageHandler
{
///
/// Handles the incoming message asynchronously.
///
/// The message to handle.
/// The execution context.
/// The to monitor for cancellation requests.
/// The default is .
/// A task that represents the asynchronous operation.
ValueTask HandleAsync(TMessage message, IWorkflowContext context, CancellationToken cancellationToken = default);
}