using ZB.MOM.WW.ScadaBridge.Commons.Messages.DebugView;
using ZB.MOM.WW.ScadaBridge.Communication;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
///
/// Default — a thin facade over the
/// existing single-shot
/// Ask (the same
/// Deployer-gated snapshot path the CLI debug snapshot command and the
/// Debug View use). Each call issues one
/// with a fresh correlation id.
///
public sealed class CommunicationInstanceSnapshotClient : IInstanceSnapshotClient
{
private readonly CommunicationService _communication;
///
/// Initializes a new instance of the class.
///
/// Central-side cluster communication service.
public CommunicationInstanceSnapshotClient(CommunicationService communication)
{
_communication = communication ?? throw new ArgumentNullException(nameof(communication));
}
///
public Task GetSnapshotAsync(
string siteIdentifier,
string instanceUniqueName,
CancellationToken cancellationToken = default)
{
var request = new DebugSnapshotRequest(instanceUniqueName, Guid.NewGuid().ToString("N"));
return _communication.RequestDebugSnapshotAsync(siteIdentifier, request, cancellationToken);
}
}