using EnvelopeGenerator.Application.Exceptions; namespace EnvelopeGenerator.Application.Common.Dto.PSPDFKitInstant; /// /// /// public 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; } } /// /// /// public List? Bbox { get; set; } /// /// /// public string? Type { get; set; } /// /// /// public bool IsSignature { get; set; } /// /// /// public string? ImageAttachmentId { get; set; } /// /// /// public Lines? Lines { get; set; } /// /// /// public int PageIndex { get; set; } /// /// /// public string? StrokeColor { get; set; } }