namespace DocumentService.Application.Common.DTOs; /// /// Represents metadata of a single PDF attachment (embedded file). /// Immutable value object containing file information without the actual binary data. /// /// /// Initializes a new instance of the AttachmentMetadata class. /// /// Attachment file name /// MIME type (e.g., "text/xml") /// File size in bytes public sealed class AttachmentMetadata(string fileName, string mimeType, long sizeBytes) { /// /// Gets the attachment file name (e.g., "invoice.xml", "document.pdf") /// public string FileName { get; } = fileName ?? string.Empty; /// /// Gets the MIME type of the attachment (e.g., "text/xml", "application/pdf") /// public string MimeType { get; } = mimeType ?? "application/octet-stream"; // Default MIME type if unknown /// /// Gets the attachment file size in bytes /// public long SizeBytes { get; } = sizeBytes; /// /// Gets the attachment file size in kilobytes (computed property) /// public double SizeKB => SizeBytes / 1024.0; /// /// Gets the attachment file size in megabytes (computed property) /// public double SizeMB => SizeBytes / 1024.0 / 1024.0; public override string ToString() { return $"{FileName} ({MimeType}, {SizeKB:F2} KB)"; } }