namespace ZB.MOM.WW.ScadaBridge.Transport.Import;
///
/// Transport-004: thrown by when the caller
/// has exceeded the configured per-IP-per-hour unlock attempt cap
/// (). The 429-equivalent
/// signal: the caller must wait for the trailing-hour window to roll forward before
/// another passphrase attempt is accepted.
///
public sealed class BundleUnlockRateLimitedException : Exception
{
///
/// Rate-limit key the limiter rejected the attempt against — the caller IP when
/// supplied, or the bundle's content hash as the architectural fallback (the
/// importer has no IHttpContext dependency by design).
///
public string ClientKey { get; }
/// Per-window cap that was reached.
public int Limit { get; }
///
/// Initializes a new .
///
/// The rate-limit key that exceeded its budget.
/// The configured per-window cap.
public BundleUnlockRateLimitedException(string clientKey, int limit)
: base(
$"Bundle unlock rate limit reached ({limit} attempts per hour). "
+ "Wait for the trailing-hour window to expire before retrying.")
{
ClientKey = clientKey ?? throw new ArgumentNullException(nameof(clientKey));
Limit = limit;
}
}