using CloudPrint.Client.Infrastructure; namespace CloudPrint.Client.Models; public sealed class CloudPrintDocument : ObservableObject { private string _title = string.Empty; private string _description = string.Empty; private string _categoryName = "未分类"; private bool _isUploaded; 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 Title { get => _title; set => SetProperty(ref _title, value); } public string Description { get => _description; set => SetProperty(ref _description, value); } public string CategoryName { get => _categoryName; set => SetProperty(ref _categoryName, value); } public bool IsUploaded { get => _isUploaded; set => SetProperty(ref _isUploaded, value); } public string SyncStatus { get => _syncStatus; set => SetProperty(ref _syncStatus, value); } 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"; } } }