namespace Meezi.Core.Entities;

/// <summary>
/// Immutable record of a sensitive POS / management action. Written by
/// <c>IAuditLogService</c> and never updated. Branch-scoped so the strict
/// branch isolation filter applies (café-wide sessions see all).
/// </summary>
public class AuditLog : TenantEntity
{
    /// <summary>High-level grouping, e.g. "Order", "Payment", "Register", "Staff".</summary>
    public string Category { get; set; } = string.Empty;

    /// <summary>Specific action, e.g. "OrderCancelled", "ItemVoided", "PaymentRecorded".</summary>
    public string Action { get; set; } = string.Empty;

    /// <summary>The entity acted upon, e.g. "Order", "Shift".</summary>
    public string? EntityType { get; set; }

    /// <summary>Id of the affected entity.</summary>
    public string? EntityId { get; set; }

    public string? BranchId { get; set; }

    /// <summary>Employee who performed the action (null for system/automated).</summary>
    public string? ActorId { get; set; }
    public string? ActorName { get; set; }
    public string? ActorRole { get; set; }

    /// <summary>Human-readable one-line summary (already localized at write time or neutral).</summary>
    public string Summary { get; set; } = string.Empty;

    /// <summary>Optional structured payload (before/after, amounts, reason) as JSON.</summary>
    public string? DetailsJson { get; set; }
}
