using EonaCat.LogStack.Core;
using System.Threading;

namespace EonaCat.LogStack.Boosters;

/// <summary>
/// Adds a monotonic event sequence number. Helpful for ordering events across async pipelines.
/// </summary>
public sealed class SequenceBooster : BoosterBase
{
    private long _sequence;

    public SequenceBooster() : base("Sequence") { }

    public override bool Boost(ref LogEventBuilder builder)
    {
        builder.WithProperty("sequence", Interlocked.Increment(ref _sequence));
        return true;
    }
}
