namespace ZB.MOM.WW.ScadaBridge.Transport;
public sealed class TransportOptions
{
/// Gets or sets the TTL in minutes for an in-progress import session.
public int BundleSessionTtlMinutes { get; set; } = 30;
/// Gets or sets the maximum allowed bundle size in megabytes.
public int MaxBundleSizeMb { get; set; } = 100;
///
/// T-006: maximum allowed decompressed size of any single zip entry in megabytes.
/// A 100 MB DEFLATE-compressed bundle can decompress to gigabytes; this cap
/// stops a malicious bundle from OOM-ing the central node before its entries
/// are decompressed.
///
public int MaxBundleEntryDecompressedMb { get; set; } = 200;
///
/// T-006: maximum permitted number of entries inside a bundle zip. A well-formed
/// bundle has exactly two (manifest.json plus content.json or
/// content.enc); a small upper bound limits the surface a zip-bomb can
/// exploit without rejecting future schema additions out of hand.
///
public int MaxBundleEntryCount { get; set; } = 4;
///
/// T-006: maximum permitted compression ratio (uncompressed length / compressed
/// length) per zip entry. Defence-in-depth against decompression bombs whose
/// declared is
/// trustworthy on read; legitimate JSON compresses around 5–10x, so 50x has
/// generous headroom for unusually compressible bundles.
///
public int MaxBundleEntryCompressionRatio { get; set; } = 50;
///
/// #05-T24: maximum number of concurrently-open import sessions. Each open
/// session pins a fully-decrypted bundle (up to
/// of plaintext) in memory until it expires or is applied/cancelled, so this
/// bounds the N×~200 MB decrypted-content footprint the central node can hold.
///
public int MaxConcurrentImportSessions { get; set; } = 8;
/// Gets or sets the maximum number of failed passphrase unlock attempts before a session is locked.
public int MaxUnlockAttemptsPerSession { get; set; } = 3;
/// Gets or sets the maximum number of unlock attempts allowed per IP address per hour.
public int MaxUnlockAttemptsPerIpPerHour { get; set; } = 10;
/// Gets or sets the PBKDF2 iteration count used for passphrase key derivation.
public int Pbkdf2Iterations { get; set; } = 600_000;
/// Gets or sets the major version of the bundle schema this instance produces and accepts.
public int SchemaVersionMajor { get; set; } = 1;
///
/// Human-readable name of the cluster/environment producing bundles. Stamped
/// into BundleManifest.SourceEnvironment and surfaced in the export
/// filename (scadabundle-{SourceEnvironment}-{yyyy-MM-dd-HHmmss}.scadabundle).
/// Bound from Transport:SourceEnvironment in appsettings*.json;
/// the default placeholder is fine for single-cluster deployments.
///
public string SourceEnvironment { get; set; } = "scadabridge";
}