namespace OmsorgCore.Engine.Events;

/// <summary>
/// Generisches Ereignis für nicht-Entity-Aktionen (Login/Logout/Session-Kill/...), die der
/// SaveChanges-Interceptor nicht automatisch erfasst, weil keine AuditableEntity verändert wird.
/// Ein Dispatch-Aufruf pro Aktionsstelle im Api-Layer, analog zu <see cref="EmployeeCreatedEvent"/>.
/// </summary>
public class AuditEvent : IDomainEvent
{
    public Guid? ActorUserId { get; }
    public string? ActorUsername { get; }
    public string? IpAddress { get; }
    public string Action { get; }
    public string? Details { get; }
    public DateTime OccurredAt { get; }

    public AuditEvent(Guid? actorUserId, string? actorUsername, string? ipAddress, string action, string? details = null)
    {
        ActorUserId = actorUserId;
        ActorUsername = actorUsername;
        IpAddress = ipAddress;
        Action = action;
        Details = details;
        OccurredAt = DateTime.UtcNow;
    }
}
