using AsbCloudApp.Data.Trajectory;
using ClosedXML.Excel;

namespace AsbCloudInfrastructure.Services.Trajectory.Import
{

    public class TrajectoryFactManualParserService : TrajectoryParserService<TrajectoryGeoFactDto>
    {
        public override string templateFileName { get; } = "TrajectoryFactManualTemplate.xlsx";
        public override string usingTemplateFile { get; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
        public override string sheetName { get; } = "Фактическая траектория";
        public override int headerRowsCount { get; } = 2;

        protected override TrajectoryGeoFactDto ParseRow(IXLRow row)
        {
            var trajectoryRow = new TrajectoryGeoFactDto
            {
                WellboreDepth = row.Cell(1).GetCellValue<double>(),
                ZenithAngle = row.Cell(2).GetCellValue<double>(),
                AzimuthGeo = row.Cell(3).GetCellValue<double>(),
                AzimuthMagnetic = row.Cell(4).GetCellValue<double>(),
                VerticalDepth = row.Cell(5).GetCellValue<double>(),
                Comment = row.Cell(6).GetCellValue<string?>()
            };
            //TODO: Добавить валидацию модели IValidatableObject
            return trajectoryRow;
        }
    }
}