namespace ZB.MOM.WW.MxGateway.Server.Security.Authentication;

/// <summary>
/// Stores and retrieves audit events for API key operations.
/// </summary>
public interface IApiKeyAuditStore
{
    /// <summary>
    /// Appends an audit entry to the audit log.
    /// </summary>
    /// <param name="entry">Audit entry to record.</param>
    /// <param name="cancellationToken">Token to cancel the asynchronous operation.</param>
    /// <returns>Asynchronous task representing the append operation.</returns>
    Task AppendAsync(ApiKeyAuditEntry entry, CancellationToken cancellationToken);

    /// <summary>
    /// Lists the most recent audit entries, up to the specified count.
    /// </summary>
    /// <param name="count">Maximum number of entries to return.</param>
    /// <param name="cancellationToken">Token to cancel the asynchronous operation.</param>
    /// <returns>Asynchronous task returning the list of audit records.</returns>
    Task<IReadOnlyList<ApiKeyAuditRecord>> ListRecentAsync(int count, CancellationToken cancellationToken);
}
