This commit implements a complete rebranding of the project: - Updated all namespaces from `DocumentOperator` to `DocumentService`. - Renamed file paths, embedded resources, and test data references. - Updated configuration keys, logging paths, and Redis instance names. - Revised documentation to reflect the new project name. - Modified project and solution files to align with the new structure. - Updated class names, DTOs, commands, queries, and handlers. - Adjusted middleware, controllers, and API endpoints. - Updated Swagger metadata and API titles to `DocumentService API`. - Refactored test namespaces, resource paths, and embedded resources. - Updated build and deployment configurations for the new name. - Replaced all references to `DocumentOperator` in comments and literals. These changes ensure consistency across the codebase and documentation.
61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
namespace DocumentService.Application.Common.DTOs;
|
|
|
|
/// <summary>
|
|
/// Represents complete attachment information for a PDF document.
|
|
/// Immutable value object containing attachment presence flag, count, and detailed metadata.
|
|
/// </summary>
|
|
public sealed class AttachmentInfo
|
|
{
|
|
/// <summary>
|
|
/// Gets a value indicating whether the PDF contains any attachments
|
|
/// </summary>
|
|
public bool HasAttachments { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the total number of attachments in the PDF
|
|
/// </summary>
|
|
public int AttachmentCount { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the collection of attachment metadata (file details)
|
|
/// </summary>
|
|
public IReadOnlyList<AttachmentMetadata> Attachments { get; }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the AttachmentInfo class.
|
|
/// </summary>
|
|
/// <param name="hasAttachments">Whether PDF has attachments</param>
|
|
/// <param name="attachmentCount">Total number of attachments</param>
|
|
/// <param name="attachments">List of attachment metadata (can be empty)</param>
|
|
public AttachmentInfo(bool hasAttachments, int attachmentCount, IReadOnlyList<AttachmentMetadata> attachments)
|
|
{
|
|
HasAttachments = hasAttachments;
|
|
AttachmentCount = attachmentCount;
|
|
Attachments = attachments ?? [];
|
|
|
|
// Defensive Programming: Ensure count matches list length
|
|
if (Attachments.Count != attachmentCount)
|
|
{
|
|
throw new ArgumentException(
|
|
$"Attachment count mismatch: expected {attachmentCount}, got {Attachments.Count}",
|
|
nameof(attachments));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates an AttachmentInfo instance for a PDF with no attachments.
|
|
/// </summary>
|
|
public static AttachmentInfo Empty =>
|
|
new(
|
|
hasAttachments: false,
|
|
attachmentCount: 0,
|
|
attachments: []);
|
|
|
|
public override string ToString()
|
|
{
|
|
return HasAttachments
|
|
? $"PDF has {AttachmentCount} attachment(s): {string.Join(", ", Attachments.Select(a => a.FileName))}"
|
|
: "PDF has no attachments";
|
|
}
|
|
}
|