using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Requests.ExportOptions;
using AsbCloudApp.Services;
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;

namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;

public class ProcessMapPlanReamExportService : ProcessMapPlanExportService<ProcessMapPlanReamDto>
{
	protected override ITemplateParameters TemplateParameters => new ProcessMapPlanReamTemplate();

	public ProcessMapPlanReamExportService(
		IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
		IWellService wellService)
		: base(processMapPlanRepository, wellService)
	{
	}
	
	protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
	{
		var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);

		return $"{caption}_РТК_План_проработка.xlsx";
	}
}