// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Text.Json.Serialization;
namespace Microsoft.Agents.AI.Workflows;
///
/// A unique identifier of an within a .
///
public readonly struct EdgeId : IEquatable
{
[JsonConstructor]
internal EdgeId(int edgeIndex)
{
this.EdgeIndex = edgeIndex;
}
internal int EdgeIndex { get; }
///
public override bool Equals(object? obj)
{
if (obj is null)
{
return false;
}
if (obj is EdgeId edgeId)
{
return this.EdgeIndex == edgeId.EdgeIndex;
}
if (obj is int edgeIndex)
{
return this.EdgeIndex == edgeIndex;
}
return false;
}
///
public bool Equals(EdgeId other)
{
return this.EdgeIndex == other.EdgeIndex;
}
///
public override int GetHashCode()
{
return this.EdgeIndex.GetHashCode();
}
///
public static bool operator ==(EdgeId left, EdgeId right) => left.Equals(right);
///
public static bool operator !=(EdgeId left, EdgeId right) => !left.Equals(right);
///
public override string ToString() => this.EdgeIndex.ToString();
}