namespace NATS.Server.JetStream;

/// <summary>
/// API usage counters for JetStream.
/// Go reference: server/jetstream.go JetStreamAPIStats.
/// </summary>
public sealed class JetStreamApiStats
{
    public int Level { get; set; }
    public ulong Total { get; set; }
    public ulong Errors { get; set; }
    public int Inflight { get; set; }
}

/// <summary>
/// Per-tier JetStream resource view.
/// Go reference: server/jetstream.go JetStreamTier.
/// </summary>
public sealed class JetStreamTier
{
    public string Name { get; set; } = string.Empty;
    public long Memory { get; set; }
    public long Store { get; set; }
    public int Streams { get; set; }
    public int Consumers { get; set; }
}

/// <summary>
/// Per-account JetStream limits.
/// Go reference: server/jetstream.go JetStreamAccountLimits.
/// </summary>
public sealed class JetStreamAccountLimits
{
    public long MaxMemory { get; set; }
    public long MaxStore { get; set; }
    public int MaxStreams { get; set; }
    public int MaxConsumers { get; set; }
    public int MaxAckPending { get; set; }
    public long MemoryMaxStreamBytes { get; set; }
    public long StoreMaxStreamBytes { get; set; }
    public bool MaxBytesRequired { get; set; }
    public Dictionary<string, JetStreamTier> Tiers { get; set; } = new(StringComparer.Ordinal);
}

/// <summary>
/// Server-level JetStream usage stats.
/// Go reference: server/jetstream.go JetStreamStats.
/// </summary>
public sealed class JetStreamStats
{
    public long Memory { get; set; }
    public long Store { get; set; }
    public long ReservedMemory { get; set; }
    public long ReservedStore { get; set; }
    public int Accounts { get; set; }
    public int HaAssets { get; set; }
    public JetStreamApiStats Api { get; set; } = new();
}
