using PowderCoating.Core.Entities;

namespace PowderCoating.Core.Interfaces.Services;

/// <summary>
/// Writes platform-wide audit trail entries. <see cref="AuditLog"/> is not a
/// <see cref="BaseEntity"/> (no soft delete, no tenant filter), so it cannot use the generic
/// <see cref="IRepository{T}"/>; this service provides the only write path for audit records
/// and keeps <c>ApplicationDbContext</c> out of controller constructors.
/// </summary>
public interface IAuditLogService
{
    /// <summary>
    /// Persists <paramref name="entry"/> to the audit log immediately.
    /// </summary>
    Task LogAsync(AuditLog entry);

    /// <summary>
    /// Returns the most recent <paramref name="limit"/> audit log entries for the given user
    /// where <c>EntityType == "ApplicationUser"</c>, ordered newest-first. Used by the
    /// SuperAdmin user login history panel.
    /// </summary>
    Task<List<AuditLog>> GetUserActivityAsync(string userId, int limit = 50);
}
