using System.IO; using System.Threading; using System.Threading.Tasks; using AsbCloudApp.Data; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; using AsbCloudInfrastructure.Services.ExcelServices; namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export; public abstract class ProcessMapPlanExportService : ExportExcelService, IProcessMapPlanExportService where TDto : ChangeLogAbstract { protected readonly IWellService wellService; private readonly IChangeLogRepository processMapPlanRepository; protected ProcessMapPlanExportService(IChangeLogRepository processMapPlanRepository, IWellService wellService) { this.processMapPlanRepository = processMapPlanRepository; this.wellService = wellService; } public async Task<(string FileName, Stream File)> ExportAsync(int idWell, CancellationToken token) { var request = new ProcessMapPlanBaseRequestWithWell(idWell); var dtos = await processMapPlanRepository.Get(request, token); var fileName = await BuildFileNameAsync(idWell, token); var file = Export(dtos); return (fileName, file); } protected abstract Task BuildFileNameAsync(int idWell, CancellationToken token); }