namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services; /// /// Outcome of a single move-data-connection command dispatch. Wraps either success /// or a human-readable guard error, so the move dialog can render an inline result /// rather than reasoning about transport exceptions or the three management response /// shapes. /// /// Whether the move succeeded. /// A human-readable error message when is false; otherwise null. public record DataConnectionMoveResult(bool Success, string? Error) { /// Creates a successful result. /// A successful . public static DataConnectionMoveResult Ok() => new(true, null); /// Creates a failed result carrying . /// The human-readable failure (typically a server guard message). /// A failed . public static DataConnectionMoveResult Fail(string error) => new(false, error); } /// /// CentralUI facade over the move-data-connection management command. It /// dispatches the strongly-typed MoveDataConnectionCommand to the central /// ManagementActor through the in-process ManagementActorHolder seam — /// the SAME Ask path the HTTP /management endpoint uses — so the server remains /// the single enforcer of the Designer role gate and every move guard (target site /// exists, no name collision at the target, no instance binding references it, no /// name-based native-alarm-source references). The UI re-implements none of that: a /// move is a command submitted to the server, and any guard failure comes back as a /// classified error. /// /// /// The current Blazor principal is projected to an AuthenticatedUser so the /// server's role gate runs against the real identity. ManagementUnauthorized / /// ManagementError / transport faults collapse into a typed /// so the caller renders an inline outcome /// rather than throwing. Mirrors ISecuredWriteService. /// public interface IDataConnectionMoveService { /// /// Moves the connection identified by to /// via the guard-running ManagementActor. /// /// Primary key of the connection to move. /// Primary key of the destination site. /// Cancellation token. /// A task that resolves to a — success, or a classified guard / transport failure. Task MoveAsync( int connectionId, int targetSiteId, CancellationToken cancellationToken = default); }