namespace ZB.MOM.WW.OtOpcUa.Commons.Messages.Admin;

/// <summary>
///     Shared DPS topic for driver-control commands (<see cref="RestartDriver"/>,
///     <see cref="ReconnectDriver"/>). Publishers (AdminOperationsActor) and subscribers
///     (DriverHostActor) reference this single constant so renames can't silently
///     desynchronise.
/// </summary>
public static class DriverControlTopic
{
    public const string Name = "driver-control";
}

/// <summary>
///     AdminUI → AdminOperationsActor: restart the driver actor for one instance.
///     A restart fully stops and respawns the actor — loses in-memory state, may briefly
///     interrupt active subscriptions. The driver actor's supervisor performs the work.
/// </summary>
/// <param name="ClusterId">Cluster scope identifier (for audit).</param>
/// <param name="DriverInstanceId">The driver instance to restart.</param>
/// <param name="ActorByUserName">The authenticated admin user who triggered the restart.</param>
/// <param name="CorrelationId">Round-trip correlation token.</param>
public sealed record RestartDriver(
    string ClusterId,
    string DriverInstanceId,
    string ActorByUserName,
    Guid CorrelationId);

/// <summary>Reply for <see cref="RestartDriver"/>.</summary>
/// <param name="Ok">True iff the operation was dispatched without error.</param>
/// <param name="Message">Failure reason; null on success.</param>
/// <param name="CorrelationId">Echoes the request's correlation token.</param>
public sealed record RestartDriverResult(
    bool Ok,
    string? Message,
    Guid CorrelationId);
