using HotelBusinessLogic.OfficePackage.HelpersEnums;
using HotelBusinessLogic.OfficePackage.HelpersModels;

namespace HotelBusinessLogic.OfficePackage;

public abstract class AbstractSaveToWord
{
    public void CreateDoc(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 mc in info.ListCleaningModels)
            {
                string? set = mc.CleaningInstruments
                    .Values
                    .Select(x => x.Type)
                    .ToList()
                    .ToString();

                CreateParagraph(new WordParagraph
                {
                    Texts = new List<(string, WordTextProperties)>
                    {(
                            mc.StartDate.ToShortDateString() + " - " + mc.RoomNumber + " - " + set, new WordTextProperties { Size = "24", Bold=true}
                    )},
                    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);
}