namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
public record MgmtDeployArtifactsCommand(int? SiteId = null);
///
/// Deploys every deployable instance at one site in a single operation.
///
///
/// Distinct from , which ships the
/// SYSTEM-WIDE artifact sets (shared scripts, external systems, DB/data
/// connections) to a site. This command deploys the site's INSTANCE
/// configurations — the same per-instance pipeline
/// MgmtDeployInstanceCommand runs, batched.
///
///
///
/// Not all-or-nothing: each instance keeps its own deployment id, revision hash,
/// operation lock and status record, and a failure on one is reported as a failed
/// row while the rest proceed. Individually retryable via the single-instance
/// deploy. Additive contract; new fields go on the end with a default.
///
///
/// Database id of the target site. Required — this command is never fleet-wide.
///
/// Deploy every deployable instance even when its flattened config already matches
/// the revision the site is running. Default : an unchanged
/// instance is skipped and reported in the summary's SkippedInstances,
/// because a redeploy resets static attribute overrides and native alarm state at
/// the site. Set it when central's recorded state cannot be trusted — a site whose
/// data volume was restored or whose node was rebuilt looks up-to-date from central
/// and needs the push anyway. Never overrides the Disabled skip.
///
public record MgmtDeploySiteCommand(int SiteId, bool Force = false);
///
/// Bulk-deploys every instance in one area SUBTREE — the area plus every area
/// nested beneath it at any depth — with exactly the rules of
/// : Disabled instances are always skipped,
/// up-to-date ones are skipped unless is set, and the batch is
/// not all-or-nothing. Answers with the same site deployment summary. Deployer-only,
/// site-scoped by the area's owning site (Gitea #40).
///
/// Database id of the subtree's root area.
///
/// Redeploy instances whose config already matches the deployed revision. Never
/// overrides the Disabled skip. Same meaning as .
///
public record MgmtDeployAreaCommand(int AreaId, bool Force = false);
public record QueryDeploymentsCommand(int? InstanceId = null, string? Status = null, int Page = 1, int PageSize = 50);
///
/// Result wrapper for .
///
///
/// The handler used to return a bare row array. It cannot any more: the page size
/// is now BOUNDED (a non-positive PageSize no longer means "unlimited" —
/// deferred-work register row 87), and a bounded page without a total is a silent
/// truncation. is what lets a caller tell "that is all of
/// them" from "there is more, ask for page 2". Mirrors
/// AuditLogQueryResult / SecuredWriteListResult, the other paged
/// management query results.
///
///
///
/// and echo the values the server
/// actually applied, which are not necessarily the ones requested: both are
/// floored/clamped/defaulted server-side, so the echo is the only way a caller
/// learns the effective slice. Additive contract; new fields go on the end with a
/// default.
///
///
/// The requested page of deployment rows, newest first.
/// Total rows matching the filter across all pages.
/// The 1-based page number actually served.
/// The page size actually applied.
public record DeploymentQueryResult(
IReadOnlyList Deployments,
int TotalCount,
int Page,
int PageSize);
public record GetDeploymentDiffCommand(int InstanceId);