using AsbCloudApp.Data;
using ClosedXML.Excel;
using System;
using System.Collections.Generic;
using System.Linq;

namespace AsbCloudInfrastructure.Services.DrillingProgram
{
#nullable enable
    public class ContentListSheet
    {
        private readonly List<DrillingProgramPartDto> parts;

        public ContentListSheet(IEnumerable<DrillingProgramPartDto> parts)
        {
            this.parts = parts.ToList();
        }

        public void Draw(IXLWorksheet sheet)
        {
            sheet.Style.Font.FontName = "Calibri";
            sheet.Style.Font.FontSize = 12;

            sheet.Cell(2, 2)
                .SetValue("Содержание")
                .Style
                    .Font.SetBold(true)
                    .Font.SetFontSize(14);

            for (int i = 0; i < parts.Count; i++)
            {
                sheet.Cell(4 + i, 1)
                    .SetValue(i + 1);

                sheet.Cell(4 + i, 2)
                    .SetValue(parts[i].Name);
            }                
        }
    }
#nullable disable
}