using System.Security.Claims;

namespace adas_core.Application.Services.Interfaces;

public interface ILocalAuditService
{
    /// <summary>
    /// Creates an asynchronous audit log entry capturing the original and modified data along with the user responsible for the change.
    /// </summary>
    /// <param name="user">The claims principal representing the user who performed the action being audited. May be null if the action is performed by an unauthenticated or system context.</param>
    /// <param name="dataOriginal">The original state of the data before the change. May be null when the action creates a new record.</param>
    /// <param name="dataModified">The modified state of the data after the change. May be null when the action deletes an existing record.</param>
    /// <param name="reason">An optional explanation or justification for the change. Defaults to null when no reason is provided.</param>
    /// <returns>A task that represents the asynchronous creation of the audit log entry.</returns>
    Task CreateAuditLogAsync(ClaimsPrincipal? user, object? dataOriginal, object? dataModified, string? reason = null);
    /// <summary>
    /// Asynchronously creates a deep copy of the specified data, producing a new independent instance of the same type.
    /// </summary>
    /// <param name="data">The data instance to be deep copied.</param>
    /// <returns>A task that represents the asynchronous operation, containing the deep-copied instance of type <typeparamref name="T"/>, or <c>null</c> if the copy could not be produced.</returns>
    Task<T?> DeepCopyAsync<T>(T data);
}