using ZB.MOM.WW.MxGateway.Contracts.Proto;
using ZB.MOM.WW.MxGateway.Server.Alarms;
using ZB.MOM.WW.MxGateway.Server.Configuration;

namespace ZB.MOM.WW.MxGateway.IntegrationTests.TestSupport;

/// <summary>
/// No-op <see cref="IAlarmWatchListResolver"/> for integration tests that
/// construct a <see cref="GatewayAlarmMonitor"/> only to satisfy the
/// <see cref="ZB.MOM.WW.MxGateway.Server.Grpc.MxAccessGatewayService"/>
/// constructor. The live MXAccess smoke tests never exercise the alarm
/// monitor, so the resolver always yields an empty watch-list rather than
/// touching the Galaxy Repository the production
/// <see cref="AlarmWatchListResolver"/> requires. Singleton because the type
/// holds no state — every consumer can share <see cref="Instance"/>.
/// </summary>
public sealed class EmptyAlarmWatchListResolver : IAlarmWatchListResolver
{
    /// <summary>Shared no-op instance.</summary>
    public static readonly EmptyAlarmWatchListResolver Instance = new();

    private static readonly IReadOnlyList<AlarmSubtagTarget> Empty = [];

    private EmptyAlarmWatchListResolver()
    {
    }

    /// <inheritdoc />
    public Task<IReadOnlyList<AlarmSubtagTarget>> ResolveAsync(
        AlarmsOptions options,
        CancellationToken cancellationToken = default)
    {
        return Task.FromResult(Empty);
    }
}
