// Copyright (c) Microsoft. All rights reserved.
using System;
using Microsoft.Shared.Diagnostics;
namespace Microsoft.Agents.AI.Workflows;
///
/// Declares that an executor may yield messages of the specified type as workflow outputs.
///
///
///
/// Apply this attribute to an class to declare the types of messages
/// it may yield via . This information is used
/// for protocol validation and documentation.
///
///
/// This attribute can be applied multiple times to declare multiple output types.
/// It is inherited by derived classes, allowing base executors to declare common output types.
///
///
///
///
/// [YieldsMessage(typeof(FinalResult))]
/// [YieldsMessage(typeof(StreamChunk))]
/// public partial class MyExecutor : Executor
/// {
/// // ...
/// }
///
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class YieldsMessageAttribute : Attribute
{
///
/// Gets the type of message that the executor may yield.
///
public Type Type { get; }
///
/// Initializes a new instance of the class.
///
/// The type of message that the executor may yield.
/// is .
public YieldsMessageAttribute(Type type)
{
this.Type = Throw.IfNull(type);
}
}