namespace ZB.MOM.WW.ScadaBridge.AuditLog.Configuration;

/// <summary>
/// Per-target redaction override applied additively on top of
/// <see cref="AuditLogOptions.GlobalBodyRedactors"/> and the
/// <see cref="AuditLogOptions.DefaultCapBytes"/> / <see cref="AuditLogOptions.ErrorCapBytes"/>
/// caps. Targets are identified by the script-facing external-system /
/// database / notification-list / inbound-API-key name.
/// </summary>
public sealed class PerTargetRedactionOverride
{
    /// <summary>Optional payload cap override (bytes); null inherits the global cap.</summary>
    public int? CapBytes { get; set; }

    /// <summary>Additional body redactor regex patterns (appended to the global list).</summary>
    public List<string>? AdditionalBodyRedactors { get; set; }

    /// <summary>
    /// Opt-in SQL parameter redaction: case-insensitive regex matched against
    /// each SQL parameter NAME in the <c>AuditingDbCommand</c> RequestSummary
    /// JSON (<c>{"sql":"...","parameters":{"@name":"value", ...}}</c>); values
    /// whose name matches are replaced with <c>&lt;redacted&gt;</c>. Null (the
    /// default) means parameter values are captured verbatim. Only applied to
    /// <see cref="ZB.MOM.WW.ScadaBridge.Commons.Types.Enums.AuditChannel.DbOutbound"/>
    /// rows.
    /// </summary>
    public string? RedactSqlParamsMatching { get; set; }

    /// <summary>
    /// When <c>true</c>, the inbound API audit row for this target records
    /// request/response headers and metadata (status, duration, actor, etc.)
    /// but the request and response body strings are omitted
    /// (<c>RequestSummary</c> / <c>ResponseSummary</c> are left null). The
    /// audit row itself is always emitted — only the body content is suppressed.
    /// Null (the default, equivalent to <c>false</c>) means body capture
    /// proceeds normally up to <see cref="AuditLogOptions.InboundMaxBytes"/>.
    /// </summary>
    public bool SkipBodyCapture { get; set; }
}
