using DigitalData.Core.Abstraction.Application.Repository;
using DigitalData.Core.Abstractions;
using EnvelopeGenerator.Application.Common.Configurations;
using EnvelopeGenerator.Domain.Entities;
using GdPicture14;
using MediatR;
using Microsoft.EntityFrameworkCore;
namespace EnvelopeGenerator.Application.Pdf;
///
///
///
public class BurnPdfCommand : IRequest
{
}
///
///
///
public class BurnPdfCommandHandler : IRequestHandler
{
///
///
///
private readonly PDFBurnerParams _pdfBurnerParams;
private readonly AnnotationManager _manager;
private readonly IRepository _signRepo;
///
///
///
///
///
///
public BurnPdfCommandHandler(PDFBurnerParams pdfBurnerParams, AnnotationManager manager, IRepository signRepo)
{
_pdfBurnerParams = pdfBurnerParams;
_manager = manager;
_signRepo = signRepo;
}
public byte[] BurnAnnotsToPDF(byte[] pSourceBuffer, List pInstantJSONList, int envelopeId)
{
// read the elements of envelope with their annotations
var elements = _signRepo
.Where(sig => sig.Document.EnvelopeId == envelopeId)
.Include(sig => sig.Annotations)
.ToList();
return elements.Any()
? BurnElementAnnotsToPDF(pSourceBuffer, elements)
: BurnInstantJSONAnnotsToPDF(pSourceBuffer, pInstantJSONList);
}
///
///
///
///
///
///
public byte[] BurnElementAnnotsToPDF(byte[] pSourceBuffer, List elements)
{
return Enumerable.Empty().ToArray();
}
///
///
///
///
///
///
public byte[] BurnInstantJSONAnnotsToPDF(byte[] pSourceBuffer, List pInstantJSONList)
{
return Enumerable.Empty().ToArray();
}
///
///
///
///
///
///
///
public Task Handle(BurnPdfCommand request, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
}