using ROLAC.API.Entities.Logging;

namespace ROLAC.API.DTOs.Logging;

/// <summary>Row shape for the System Logs grid (no heavy exception text).</summary>
public class SystemLogListItemDto
{
    public long           Id            { get; set; }
    public DateTimeOffset Timestamp     { get; set; }
    public string         Level         { get; set; } = null!;
    public string         Category      { get; set; } = null!;
    public string         Message       { get; set; } = null!;
    public bool           HasException  { get; set; }
    public int?           StatusCode    { get; set; }
    public string?        RequestPath   { get; set; }
    public string?        HttpMethod    { get; set; }
    public string?        UserId        { get; set; }
    public string?        CorrelationId { get; set; }
}

/// <summary>Full detail for the System Log dialog, including the stack trace.</summary>
public class SystemLogDetailDto : SystemLogListItemDto
{
    public int?    EventId   { get; set; }
    public string? Exception { get; set; }
    public string? IpAddress { get; set; }
}

/// <summary>Filters for the paged System Logs query.</summary>
public class SystemLogQuery
{
    public int             Page          { get; set; } = 1;
    public int             PageSize      { get; set; } = 20;
    public DateTimeOffset? From          { get; set; }
    public DateTimeOffset? To            { get; set; }
    /// <summary>Lower bound on severity (inclusive).</summary>
    public LogLevelEnum?   MinLevel      { get; set; }
    /// <summary>Exact severity match (takes precedence over MinLevel when set).</summary>
    public LogLevelEnum?   Level         { get; set; }
    public string?         Search        { get; set; }
    public string?         UserId        { get; set; }
    public string?         CorrelationId { get; set; }
}
