using CommunityToolkit.Mvvm.ComponentModel; namespace CloudPrint.Client.Models; public sealed partial class CloudPrintDocument : ObservableObject { [ObservableProperty] private string title = string.Empty; [ObservableProperty] private string description = string.Empty; [ObservableProperty] private string categoryName = "未分类"; [ObservableProperty] private bool isUploaded; [ObservableProperty] private string syncStatus = "本地"; public int Id { get; init; } public string FileName { get; init; } = string.Empty; public string FilePath { get; init; } = string.Empty; public string FileType { get; init; } = string.Empty; public long FileSize { get; init; } public string UploaderType { get; init; } = "admin"; public int UploaderId { get; init; } public int CategoryId { get; init; } public int PageCount { get; init; } public DateTime CreatedAt { get; init; } = DateTime.Now; public string FileSizeText { get { if (FileSize >= 1024 * 1024) { return $"{FileSize / 1024d / 1024d:F2} MB"; } if (FileSize >= 1024) { return $"{FileSize / 1024d:F2} KB"; } return $"{FileSize} B"; } } }