namespace Meezi.API.Services;
///
/// One sensitive POS / management action to record. Actor and tenant fields are
/// resolved from the current request context when not supplied explicitly.
///
public sealed record AuditEntry
{
public required string Category { get; init; }
public required string Action { get; init; }
public required string Summary { get; init; }
public string? EntityType { get; init; }
public string? EntityId { get; init; }
/// Optional branch override; defaults to the active branch from context.
public string? BranchId { get; init; }
/// Optional structured payload — serialized to JSON.
public object? Details { get; init; }
/// Optional actor name override (display only).
public string? ActorName { get; init; }
}
///
/// Writes immutable audit-trail entries for sensitive actions. Implementations
/// must never throw into the caller — a failed audit write must not abort the
/// business operation it records.
///
public interface IAuditLogService
{
Task LogAsync(AuditEntry entry, CancellationToken ct = default);
}