namespace ZB.MOM.WW.MxGateway.Server.Configuration;
///
/// Options controlling the gateway's self-signed certificate auto-generation.
/// Only consulted when a Kestrel HTTPS endpoint is configured without its own
/// certificate; plaintext deployments never trigger generation.
///
public sealed class TlsOptions
{
///
/// Path to the persisted self-signed PFX. Reused across restarts. The default is derived
/// from (C:\ProgramData
/// on Windows, /usr/share or the container equivalent elsewhere) so a generated
/// private key never lands in the launch working directory on a non-Windows host. The
/// production hosts override this with an explicit path; the validator rejects a non-rooted
/// override.
///
public string SelfSignedCertPath { get; init; } = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
"MxGateway",
"certs",
"gateway-selfsigned.pfx");
/// Lifetime in years of a freshly generated certificate.
public int ValidityYears { get; init; } = 10;
/// Extra DNS SANs to embed (e.g. a load-balancer name).
public IReadOnlyList AdditionalDnsNames { get; init; } = [];
/// Regenerate the persisted certificate when it has expired.
public bool RegenerateIfExpired { get; init; } = true;
}