using ROLAC.API.Entities.Logging;

namespace ROLAC.API.Services.Logging;

/// <summary>
/// Records audit events that don't flow through EF change tracking — security actions
/// (login/logout/role changes) and key business actions (check issued, expense approved, ...).
/// Data-change audits are produced automatically by <c>AuditLogInterceptor</c>; use this for the
/// semantic action + human summary the raw diff can't express.
/// </summary>
public interface IAuditLogger
{
    /// <summary>
    /// Build and enqueue an audit row. <paramref name="before"/>/<paramref name="after"/> are
    /// serialized into the <c>Changes</c> JSON. Never throws — failures are dropped like all logs.
    /// </summary>
    void Write(
        string action,
        string category,
        LogLevelEnum level = LogLevelEnum.Information,
        string? entityName = null,
        string? entityId = null,
        string? summary = null,
        object? before = null,
        object? after = null,
        string? userId = null,
        string? userEmail = null,
        string? ipAddress = null);
}
