using ROLAC.API.Entities.Logging;

namespace ROLAC.API.DTOs.Logging;

/// <summary>Row shape for the Audit Logs grid (no heavy Changes JSON).</summary>
public class AuditLogListItemDto
{
    public long           Id         { get; set; }
    public DateTimeOffset Timestamp  { get; set; }
    public string         Level      { get; set; } = null!;
    public string         Action     { get; set; } = null!;
    public string         Category   { get; set; } = null!;
    public string?        EntityName { get; set; }
    public string?        EntityId   { get; set; }
    public string?        Summary    { get; set; }
    public string?        UserId     { get; set; }
    public string?        UserEmail  { get; set; }
}

/// <summary>Full detail for the Audit Log dialog, including the before→after JSON.</summary>
public class AuditLogDetailDto : AuditLogListItemDto
{
    public string? Changes       { get; set; }
    public string? IpAddress     { get; set; }
    public string? CorrelationId { get; set; }
}

/// <summary>Filters for the paged Audit Logs query.</summary>
public class AuditLogQuery
{
    public int             Page       { get; set; } = 1;
    public int             PageSize   { get; set; } = 20;
    public DateTimeOffset? From       { get; set; }
    public DateTimeOffset? To         { get; set; }
    public string?         Category   { get; set; }
    public string?         Action     { get; set; }
    public string?         EntityName { get; set; }
    public string?         EntityId   { get; set; }
    public string?         UserId     { get; set; }
    public LogLevelEnum?   MinLevel   { get; set; }
    public string?         Search     { get; set; }
}

/// <summary>Option lists for the Audit Logs filter UI.</summary>
public class AuditCatalogDto
{
    public IReadOnlyList<string> Categories { get; set; } = [];
    public IReadOnlyList<string> Actions    { get; set; } = [];
    public IReadOnlyList<string> Levels     { get; set; } = [];
}
