namespace YMhut.Box.Core.Logging;

public interface ILogService
{
    event EventHandler<LogEntry>? EntryWritten;

    string LogPath { get; }

    Task WriteAsync(
        string level,
        string category,
        string message,
        string? detail = null,
        CancellationToken cancellationToken = default);

    Task<IReadOnlyList<LogEntry>> ReadAsync(
        string? level = null,
        string? category = null,
        int take = 500,
        CancellationToken cancellationToken = default);

    Task<IReadOnlyList<LogEntry>> ReadByDateAsync(
        DateOnly date,
        string? level = null,
        string? query = null,
        int take = 0,
        CancellationToken cancellationToken = default);

    Task<IReadOnlyList<LogEntry>> ReadByDatePageAsync(
        DateOnly date,
        string? level = null,
        string? query = null,
        int skip = 0,
        int take = 100,
        CancellationToken cancellationToken = default);

    Task CleanupAsync(int retentionCount, CancellationToken cancellationToken = default);

    Task ClearAllAsync(CancellationToken cancellationToken = default);

    Task ClearTodayAsync(CancellationToken cancellationToken = default);

    Task ClearFilteredTodayAsync(
        string? level = null,
        string? query = null,
        CancellationToken cancellationToken = default);
}
