using System;

namespace ZB.MOM.WW.MxGateway.Worker.MxAccess;

public sealed class WorkerRuntimeHeartbeatSnapshot
{
    /// <summary>Initializes a new instance of the <see cref="WorkerRuntimeHeartbeatSnapshot"/> class.</summary>
    /// <param name="lastStaActivityUtc">Timestamp of the last STA thread activity in UTC.</param>
    /// <param name="pendingCommandCount">Number of commands awaiting processing.</param>
    /// <param name="outboundEventQueueDepth">Current depth of the worker event queue.</param>
    /// <param name="lastEventSequence">Sequence number of the most recent event.</param>
    /// <param name="currentCommandCorrelationId">Correlation ID of the in-flight command.</param>
    public WorkerRuntimeHeartbeatSnapshot(
        DateTimeOffset lastStaActivityUtc,
        uint pendingCommandCount,
        uint outboundEventQueueDepth,
        ulong lastEventSequence,
        string currentCommandCorrelationId)
    {
        LastStaActivityUtc = lastStaActivityUtc;
        PendingCommandCount = pendingCommandCount;
        OutboundEventQueueDepth = outboundEventQueueDepth;
        LastEventSequence = lastEventSequence;
        CurrentCommandCorrelationId = currentCommandCorrelationId ?? string.Empty;
    }

    /// <summary>Gets the last STA activity timestamp in UTC.</summary>
    public DateTimeOffset LastStaActivityUtc { get; }

    /// <summary>Gets the pending command count.</summary>
    public uint PendingCommandCount { get; }

    /// <summary>Gets the current depth of the worker event queue.</summary>
    public uint OutboundEventQueueDepth { get; }

    /// <summary>Gets the sequence number of the most recent event.</summary>
    public ulong LastEventSequence { get; }

    /// <summary>Gets the correlation ID of the in-flight command.</summary>
    public string CurrentCommandCorrelationId { get; }
}
