using System.ComponentModel.DataAnnotations;
using System.IO;
using AsbCloudApp.Data;
using AsbCloudApp.Requests.ParserOptions;
using AsbCloudInfrastructure.Services.ExcelServices.Templates;

namespace AsbCloudInfrastructure.Services.ExcelServices;

public abstract class ExcelWellRelatedParser<TDto, TOptions, TTemplate> : ExcelParser<TDto, TOptions, TTemplate>
	where TDto : class, IValidatableObject, IId, IWellRelated
	where TOptions : WellRelatedParserRequest
	where TTemplate : class, ITemplateParameters, new()
{
	public override ParserResultDto<TDto> Parse(Stream file, TOptions options)
	{
		var result = base.Parse(file, options);

		foreach (var dto in result.Item)
			dto.Item.IdWell = options.IdWell;

		return result;
	}
}