namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
public record AuthenticatedUser(
string Username, string DisplayName,
string[] Roles, string[] PermittedSiteIds);
/// The authenticated caller.
/// The management command to run.
/// Per-request correlation id echoed on the reply.
///
/// Remote IP of the HTTP caller, when the envelope came in over the management
/// endpoint. Additive trailing-optional (message contracts evolve additively), so
/// in-cluster senders that construct an envelope directly stay source-compatible and
/// simply carry null. Consumed by the Transport bundle handlers to enforce the
/// per-IP-per-hour unlock throttle; null degrades to a shared throttle bucket rather
/// than to no throttling (register row 44).
///
public record ManagementEnvelope(
AuthenticatedUser User,
object Command,
string CorrelationId,
string? ClientIp = null);
public record ManagementSuccess(string CorrelationId, string JsonData);
public record ManagementError(string CorrelationId, string Error, string ErrorCode);
public record ManagementUnauthorized(string CorrelationId, string Message);