using ZB.MOM.WW.ScadaBridge.Commons.Observability;

namespace ZB.MOM.WW.ScadaBridge.Host.Tests;

/// <summary>
/// Infrastructure-free guards for <see cref="ScadaBridgeTelemetry"/>: the meter name is the
/// stable value registered with OTel, and the emit helpers are safe to call (they are no-op
/// until follow-on tasks wire real emit points and a listener attaches).
/// </summary>
public class ScadaBridgeTelemetryTests
{
    [Fact]
    public void MeterName_IsStableValue()
    {
        Assert.Equal("ZB.MOM.WW.ScadaBridge", ScadaBridgeTelemetry.MeterName);
    }

    [Fact]
    public void EmitHelpers_DoNotThrow()
    {
        var ex = Record.Exception(() =>
        {
            ScadaBridgeTelemetry.RecordDeploymentApplied();
            ScadaBridgeTelemetry.RecordInboundApiRequest("X");
            ScadaBridgeTelemetry.SiteConnectionOpened();
            ScadaBridgeTelemetry.SiteConnectionClosed();
            ScadaBridgeTelemetry.LiveAlarmAggregatorStarted();
            ScadaBridgeTelemetry.LiveAlarmAggregatorStopped();
            ScadaBridgeTelemetry.RecordLiveAlarmStreamReconnect();
            ScadaBridgeTelemetry.SetQueueDepthProvider(() => 5);
        });

        Assert.Null(ex);
    }
}
