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

namespace TravelCompanyBusinessLogic.OfficePackage
{
    public abstract class AbstractSaveToWord
    {
        public void CreateGuidesDoc(WordInfo info)
        {
            CreateWord(info);
            CreateParagraph(new WordParagraph
            {
                Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
                TextProperties = new WordTextProperties
                {
                    Size = "24",
                    JustificationType = WordJustificationType.Center
                }
            });

            foreach (var reportGuideView in info.Guides)
            {
                CreateParagraph(new WordParagraph
                {
                    Texts = new List<(string, WordTextProperties)>
                    {
                        ("Обед: ", new WordTextProperties { Bold = true, Size = "24" }),
                        (reportGuideView.Travel.TravelName, new WordTextProperties { Bold = false, Size = "24" }),
                        (" Дата создания: ", new WordTextProperties { Bold = true, Size = "24" }),
                        (reportGuideView.Travel.DateStart.ToString(), new WordTextProperties { Bold = false, Size = "24" })
                    },
                    TextProperties = new WordTextProperties
                    {
                        Size = "24",
                        JustificationType = WordJustificationType.Both
                    }
                });

                CreateParagraph(new WordParagraph
                {
                    Texts = new List<(string, WordTextProperties)>
                        {
                            ("Повара: ", new WordTextProperties { Bold = true, Size = "24" })
                        },
                    TextProperties = new WordTextProperties
                    {
                        Size = "24",
                        JustificationType = WordJustificationType.Both
                    }
                });

                foreach (var guide in reportGuideView.Guides)
                {
                    CreateParagraph(new WordParagraph
                    {
                        Texts = new List<(string, WordTextProperties)>
                        {
                            (guide.Surname, new WordTextProperties { Bold = false, Size = "24" })
                        },
                        TextProperties = new WordTextProperties
                        {
                            Size = "24",
                            JustificationType = WordJustificationType.Both
                        }
                    });
                }
            }

            SaveWord(info);
        }
        public void CreateExcursionsDoc(WordInfo info)
        {
            CreateWord(info);
            CreateParagraph(new WordParagraph
            {
                Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
                TextProperties = new WordTextProperties
                {
                    Size = "24",
                    JustificationType = WordJustificationType.Center
                }
            });

            foreach (var reportExcursionView in info.Excursions)
            {
                CreateParagraph(new WordParagraph
                {
                    Texts = new List<(string, WordTextProperties)>
                    {
                        ("Продукт: ", new WordTextProperties { Bold = true, Size = "24" }),
                        (reportExcursionView.Tour.Id.ToString(), new WordTextProperties { Bold = false, Size = "24" }),
                        ("Название: ", new WordTextProperties { Bold = true, Size = "24" }),
                        (reportExcursionView.Tour.TourName.ToString(), new WordTextProperties { Bold = false, Size = "24" })
                    },
                    TextProperties = new WordTextProperties
                    {
                        Size = "24",
                        JustificationType = WordJustificationType.Both
                    }
                });

                CreateParagraph(new WordParagraph
                {
                    Texts = new List<(string, WordTextProperties)>
                        {
                            ("Заказы: ", new WordTextProperties { Bold = true, Size = "24" })
                        },
                    TextProperties = new WordTextProperties
                    {
                        Size = "24",
                        JustificationType = WordJustificationType.Both
                    }
                });

                foreach (var excursion in reportExcursionView.Excursions)
                {
                    CreateParagraph(new WordParagraph
                    {
                        Texts = new List<(string, WordTextProperties)>
                        {
                            ("Заказ: ", new WordTextProperties { Bold = false, Size = "24" }),
                            (excursion.Id.ToString(), new WordTextProperties { Bold = false, Size = "24" })
                        },
                        TextProperties = new WordTextProperties
                        {
                            Size = "24",
                            JustificationType = WordJustificationType.Both
                        }
                    });
                }
            }

            SaveWord(info);
        }
        protected abstract void CreateWord(WordInfo info);
        protected abstract void CreateParagraph(WordParagraph paragraph);
        protected abstract void SaveWord(WordInfo info);
    }
}
