122 lines
2.8 KiB
C#
122 lines
2.8 KiB
C#
using EnvelopeGenerator.Application.Exceptions;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Dto.PSPDFKitInstant;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class Annotation
|
|
{
|
|
private string? _id;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public int EnvelopeId { get; private set; } = 0;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public int ReceiverId { get; private set; } = 0;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public int Index { get; private set; } = 0;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string EgName { get; private set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public bool HasStructuredID { get; private set; } = false;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public bool IsLabel
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrEmpty(EgName))
|
|
return false;
|
|
|
|
var parts = EgName.Split('_');
|
|
return parts.Length > 1 && parts[1] == "label";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
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; }
|
|
} |