namespace ZB.MOM.WW.ScadaBridge.Transport.Import;
///
/// T-003: thrown by when an encrypted bundle has
/// exceeded the configured failed-unlock attempt limit
/// (). The lockout is tracked
/// server-side keyed by BundleManifest.ContentHash, so a second tab / CLI caller
/// re-uploading the same bytes hits the same counter and cannot side-step the limit.
///
public sealed class BundleLockedException : Exception
{
/// Number of recorded unlock failures for this bundle.
public int FailedAttempts { get; }
/// SHA-256 (hex) of the bundle's content bytes, the lockout's tracking key.
public string BundleContentHash { get; }
///
/// Initializes a new .
///
/// SHA-256 hex from BundleManifest.ContentHash.
/// Number of failures recorded against this bundle.
public BundleLockedException(string bundleContentHash, int failedAttempts)
: base(
$"Bundle is locked after {failedAttempts} failed unlock attempts. "
+ "Wait for the lockout window to expire or re-export the bundle to obtain a new content hash.")
{
BundleContentHash = bundleContentHash ?? throw new ArgumentNullException(nameof(bundleContentHash));
FailedAttempts = failedAttempts;
}
}