move PSDPFKitModels namespace to Dto and rename as PSPDFKitInstant

This commit is contained in:
2025-11-07 13:51:53 +01:00
parent 55c20e83d8
commit 5299016b43
10 changed files with 71 additions and 29 deletions

View File

@@ -1,7 +1,7 @@
using DigitalData.Core.Abstraction.Application.Repository;
using EnvelopeGenerator.Application.Common.Configurations;
using EnvelopeGenerator.Application.Exceptions;
using EnvelopeGenerator.Application.Pdf.PSPDFKitModels;
using EnvelopeGenerator.Application.Common.Dto.PSPDFKitInstant;
using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Entities;
using GdPicture14;

View File

@@ -1,98 +0,0 @@
using EnvelopeGenerator.Application.Exceptions;
namespace EnvelopeGenerator.Application.Pdf.PSPDFKitModels;
internal class Annotation
{
private string? _id;
public int EnvelopeId { get; private set; } = 0;
public int ReceiverId { get; private set; } = 0;
public int Index { get; private set; } = 0;
public string EgName { get; private set; } = string.Empty;
public bool HasStructuredID { get; private set; } = false;
public bool IsLabel
{
get
{
if (string.IsNullOrEmpty(EgName))
return false;
var parts = EgName.Split('_');
return parts.Length > 1 && parts[1] == "label";
}
}
public string? Id
{
get => _id;
set
{
_id = value;
if (string.IsNullOrWhiteSpace(value))
throw new BurnAnnotationException("The identifier of annotation is null or empty.");
var parts = value.Split('#');
if (parts.Length != 4)
return;
// throw new BurnAnnotationException($"The identifier of annotation has more or less than 4 sub-part. Id: {_id}");
if (!int.TryParse(parts[0], out int envelopeId))
throw new BurnAnnotationException($"The envelope ID of annotation is not integer. Id: {_id}");
EnvelopeId = envelopeId;
if (!int.TryParse(parts[1], out int receiverId))
throw new BurnAnnotationException($"The receiver ID of annotation is not integer. Id: {_id}");
ReceiverId = receiverId;
if (!int.TryParse(parts[2], out int index))
throw new BurnAnnotationException($"The index of annotation is not integer. Id: {_id}");
Index = index;
EgName = parts[3];
HasStructuredID = true;
}
}
/// <summary>
///
/// </summary>
public List<double>? Bbox { get; set; }
/// <summary>
///
/// </summary>
public string? Type { get; set; }
/// <summary>
///
/// </summary>
public bool IsSignature { get; set; }
/// <summary>
///
/// </summary>
public string? ImageAttachmentId { get; set; }
/// <summary>
///
/// </summary>
public Lines? Lines { get; set; }
/// <summary>
///
/// </summary>
public int PageIndex { get; set; }
/// <summary>
///
/// </summary>
public string? StrokeColor { get; set; }
}

View File

@@ -1,8 +0,0 @@
namespace EnvelopeGenerator.Application.Pdf.PSPDFKitModels;
/// <summary>
///
/// </summary>
/// <param name="Binary"></param>
/// <param name="ContentType"></param>
public record Attachment(string Binary, string ContentType);

View File

@@ -1,8 +0,0 @@
namespace EnvelopeGenerator.Application.Pdf.PSPDFKitModels;
/// <summary>
///
/// </summary>
/// <param name="Name"></param>
/// <param name="Value"></param>
public record FormFieldValue(string Name, string? Value = null);

View File

@@ -1,8 +0,0 @@
namespace EnvelopeGenerator.Application.Pdf.PSPDFKitModels;
/// <summary>
///
/// </summary>
/// <param name="Lines"></param>
/// <param name="StrokeColor"></param>
public record Ink(Lines Lines, string? StrokeColor = null);

View File

@@ -1,32 +0,0 @@
namespace EnvelopeGenerator.Application.Pdf.PSPDFKitModels;
internal class InstantData
{
public List<Annotation>? Annotations { get; set; }
public IEnumerable<List<Annotation>>? AnnotationsByReceiver
{
get
{
return Annotations?
.Where(a => a.HasStructuredID)
.GroupBy(a => a.ReceiverId)
.Select(g => g.ToList());
}
}
public IEnumerable<List<Annotation>>? UnstructuredAnnotations
{
get
{
return Annotations?
.Where(a => !a.HasStructuredID)
.GroupBy(a => a.ReceiverId)
.Select(g => g.ToList());
}
}
public Dictionary<string, Attachment>? Attachments { get; set; }
public List<FormFieldValue>? FormFieldValues { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace EnvelopeGenerator.Application.Pdf.PSPDFKitModels;
/// <summary>
///
/// </summary>
/// <param name="Points"></param>
public record Lines(List<List<List<float>>> Points);