namespace SlpModularCms.Modules.Contact.Config;
///
/// Per-host configuration of the contact module (section Contact).
///
public class ContactOptions
{
public const string SectionName = "Contact";
///
/// Master switch. While false the contact routes answer 404 and the module touches nothing.
/// It must only be switched on for a public host once per-client rate limiting is in place
/// (see ).
///
public bool Enabled { get; set; }
/// Identifies the site on stored rows and in the token purpose. Never taken from a request.
public string? SiteId { get; set; }
/// Minimum seconds between issuing the token and submitting; faster submissions are treated as spam.
public int MinSeconds { get; set; } = 3;
public int TokenLifetimeMinutes { get; set; } = 120;
/// Months a genuine message is kept (fixed per row at insert).
public int RetentionMonths { get; set; } = 12;
/// Days a message classified as spam is kept.
public int SpamRetentionDays { get; set; } = 30;
/// Per site and UTC day; beyond it spam is answered normally but not stored.
public int MaxSpamRowsPerDay { get; set; } = 200;
public int MaxBodyBytes { get; set; } = 16384;
/// Base of the validation problem type URI. When empty the type is about:blank.
public string? ProblemTypeBase { get; set; }
public ContactCaptchaOptions Captcha { get; set; } = new();
public string EffectiveSiteId => string.IsNullOrWhiteSpace(SiteId) ? "default" : SiteId.Trim();
}
public class ContactCaptchaOptions
{
public bool Enabled { get; set; }
public string? Provider { get; set; }
public string? SiteKey { get; set; }
/// Server-side secret; supply it through the environment or a secrets manager, never committed.
public string? Secret { get; set; }
}