using System.Collections.Generic;

namespace Consulenza.ReportWriter.Business.Entity
{
    /// <summary>
    /// Classe base necessaria ad imporre dipendenze creazionali da istanze DataModel ed EnvironmentFacade.
    /// </summary>
    public class EntityBase
    {
        public readonly Consulenza.DataServices.DatiSeiUnico datiSeiUnico;
        private readonly List<ObjectPDF> _elements;
        private readonly EnvironmentFacade _environmentFacade;
        private readonly ChapterFacade _chapterfacade;
              

        protected EnvironmentFacade EnvironmentFacade { get { return _environmentFacade; } }     


        /// <summary>
        /// Costruttore originario: impone una dipendenza stretta fra il DataModel ed ogni Concrete Instance.
        /// </summary>
        /// <param name="environmentFacade"></param>     
        public EntityBase(EnvironmentFacade environmentFacade)
        {
            _elements = new List<ObjectPDF>();
            _chapterfacade = new ChapterFacade();
            _environmentFacade = environmentFacade;
            datiSeiUnico = environmentFacade.datiSeiUnico;
        }        

        /// <summary>
        /// Imposta o recupera la collezione di elementi ObjectPDF.
        /// </summary>
        public List<ObjectPDF> Elements
        {
            get { return _elements; }
        }

        /// <summary>
        /// Imposta o recupera il tipo di EntityBase cui verranno aggiunti gli elements: Chapter, Paragraph, Section.
        /// </summary>
        public EntityTypePdf EntityType { get; set; }

        /// <summary>
        /// Recupera ChapterFacade
        /// </summary>
        public ChapterFacade ChapterFacade
        {
            get { return _chapterfacade; }
        }
        /// <summary>
        /// Aggiunge l'oggetto passato in input alla collezione _elements.
        /// </summary>
        /// <param name="objectPdf">ObjectPDF da aggiungere.</param>
        public void AddElement(List<ObjectPDF> objectPdf)
        {
            foreach (ObjectPDF obj in objectPdf)
                _elements.Add(obj);
        }    

        /// <summary>
        /// Aggiunge l'oggetto passato in input alla collezione _elements.
        /// </summary>
        /// <param name="objectPdf">ObjectPDF da aggiungere.</param>
        public void AddElement(ObjectPDF objectPdf)
        {
            _elements.Add(objectPdf);
        }       
    }
}
