Files
DocumentService/DocumentService.Application/Common/DTOs/AttachmentMetadata.cs
TekH 207c778f3a Refactor: Rename DocumentOperator to DocumentService
Updated project and solution files to rename and restructure
`DocumentOperator` to `DocumentService`. Modified project
references in `DocumentService.API.csproj`, `DocumentService.Application.csproj`,
and `DocumentService.Infrastructure.csproj` to reflect the new
naming convention. Updated `DocumentService.sln` to remove
old project references, add new ones, and adjust configuration
and nested project mappings accordingly. This change aligns
the project structure with the new naming convention.
2026-08-30 21:33:25 +02:00

45 lines
1.5 KiB
C#

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