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

namespace VeterinaryBusinessLogic.OfficePackage
{
    public abstract class AbstractSaveToWordDoctor
    {
        public void CreateDoc(WordInfoDoctor 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 rec in info.PurchaseMedications)
            {
                CreateParagraph(new WordParagraph
                {
                    Texts = new List<(string, WordTextProperties)>
                    { (rec.MedicationName, new WordTextProperties { Size = "24", Bold=true})},
                    TextProperties = new WordTextProperties
                    {
                        Size = "24",
                        JustificationType = WordJustificationType.Both
                    }
                });

                foreach (var medication in rec.Purchases)
                {
                    CreateParagraph(new WordParagraph
                    {
                        Texts = new List<(string, WordTextProperties)>
                        { (medication.DateCreate.ToString(), new WordTextProperties { Size = "20", Bold=false})},
                        TextProperties = new WordTextProperties
                        {
                            Size = "24",
                            JustificationType = WordJustificationType.Both
                        }
                    });
                }
            }
            SaveWord(info);
        }

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

