using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelCompanyBusinessLogic.OfficePackage.HelperEnums;
using TravelCompanyBusinessLogic.OfficePackage.HelperModels;

namespace TravelCompanyBusinessLogic.OfficePackage
{
    public abstract class AbstractSaveToPdf
    {
       
        public void CreateGuideDoc(PdfInfo info)
        {
            CreatePdf(info);
            CreateParagraph(new PdfParagraph
            {
                Text = info.Title,
                Style = "NormalTitle"
            });
            CreateParagraph(new PdfParagraph
            {
                Text = $"с {info.DateAfter.ToShortDateString()} по {info.DateBefore.ToShortDateString()}",
                Style = "Normal"
            });
            CreateTable(new List<string> { "2cm", "4cm", "2cm", "4cm", "3cm" });
            CreateRow(new PdfRowParameters
            {
                Texts = new List<string> { "№", "Гид", "Номер","Путешествие", "Дата начала путешествия" },
                Style = "NormalTitle",
                ParagraphAlignment = PdfParagraphAlignmentType.Center
            });
            foreach (var guide in info.Guides)
            {
                CreateRow(new PdfRowParameters
                {
                    Texts = new List<string> { guide.GuideId.ToString(), guide.FIO.ToString() ,"", "", ""},
                    Style = "Normal",
                    ParagraphAlignment = PdfParagraphAlignmentType.Left
                });

                foreach (var travel in guide.Travels)
                {
                    CreateRow(new PdfRowParameters
                    {
                        Texts = new List<string> { "", "", travel.Id.ToString(), travel.TravelName, travel.DateStart.ToShortDateString() },
                        Style = "Normal",
                        ParagraphAlignment = PdfParagraphAlignmentType.Left
                    });
                }
            }
            SavePdf(info);
        }
        protected abstract void CreatePdf(PdfInfo info);
        protected abstract void CreateParagraph(PdfParagraph paragraph);
        protected abstract void CreateTable(List<string> columns);
        protected abstract void CreateRow(PdfRowParameters rowParameters);
        protected abstract void SavePdf(PdfInfo info);
    }
}
