namespace PersonalToolBox.Models;

/// <summary>
/// 日志级别
/// </summary>
public enum LogLevel
{
    Info,
    Warning,
    Error
}

/// <summary>
/// 日志条目模型，用于底部信息栏的数据绑定
/// </summary>
public class LogEntry
{
    /// <summary>
    /// 日志产生时间
    /// </summary>
    public DateTime Timestamp { get; set; } = DateTime.Now;

    /// <summary>
    /// 日志级别 (Info / Warning / Error)
    /// </summary>
    public LogLevel Level { get; set; }

    /// <summary>
    /// 日志文本内容
    /// </summary>
    public string Content { get; set; } = string.Empty;

    /// <summary>
    /// 格式化后的时间字符串 (yyyy-MM-dd HH:mm:ss)
    /// </summary>
    public string FormattedTime => Timestamp.ToString("yyyy-MM-dd HH:mm:ss");

    /// <summary>
    /// 日志级别的中文标记
    /// </summary>
    public string LevelText => Level switch
    {
        LogLevel.Info => "[信息]",
        LogLevel.Warning => "[警告]",
        LogLevel.Error => "[错误]",
        _ => "[未知]"
    };

    public override string ToString() => $"[{FormattedTime}] {LevelText} {Content}";
}
