using System; using System.Windows.Media.Imaging; namespace AxCopilot.Services; public record ClipboardEntry(string Text, DateTime CopiedAt) { public BitmapSource? Image { get; init; } public string? OriginalImagePath { get; init; } public bool IsPinned { get; set; } public string Category { get; set; } = "일반"; public bool IsText => Image == null; public string Preview { get { if (!IsText) { return "[이미지]"; } string text = Text.Replace("\r\n", "↵ ").Replace("\n", "↵ ").Replace("\r", "↵ "); return (text.Length > 80) ? (text.Substring(0, 77) + "…") : text; } } public string RelativeTime { get { TimeSpan timeSpan = DateTime.Now - CopiedAt; if (timeSpan.TotalSeconds < 60.0) { return "방금 전"; } if (timeSpan.TotalMinutes < 60.0) { return $"{(int)timeSpan.TotalMinutes}분 전"; } if (timeSpan.TotalHours < 24.0) { return $"{(int)timeSpan.TotalHours}시간 전"; } return CopiedAt.ToString("MM/dd HH:mm"); } } }