// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
using Microsoft.Agents.AI.Workflows.Execution;
namespace Microsoft.Agents.AI.Workflows.Checkpointing;
///
/// Represents a direct in the .
///
public sealed class DirectEdgeInfo : EdgeInfo
{
internal DirectEdgeInfo(DirectEdgeData data) : this(data.Condition is not null, data.Connection) { }
[JsonConstructor]
internal DirectEdgeInfo(bool hasCondition, EdgeConnection connection) : base(EdgeKind.Direct, connection)
{
this.HasCondition = hasCondition;
}
///
/// Gets a value indicating whether this direct edge has a condition associated with it.
///
public bool HasCondition { get; }
internal override bool IsMatchInternal(EdgeData edgeData)
{
return edgeData is DirectEdgeData directEdge
&& this.HasCondition == (directEdge.Condition is not null);
}
}