using Consulenza.Base.Business;
using Consulenza.ReportCommon;
using Consulenza.ReportModeler.Manager;
using Consulenza.ReportWriter.Business;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reports.Common
{
    public abstract class Report
    {

        public virtual void Render()
        {
            //var chiaveCliente = DataService.ClienteManager.RecuperaChiaveCliente("F", "DVCWTR35S02L781V", partitaIva, codiceMandato, unica);
            //var cliente = DataService.ClienteManager.RecuperaCliente(chiaveCliente, true);
            //var privateBanker = DataService.PrivateBankerManager.RecuperaPrivateBanker(chiaveCliente, true);

            //var generator = new ReportStructManager(cliente, privateBanker);
            //return generator.CreateReport(chiaveCliente, chiaveProposta, ReportType.Base_Proposta, unica);



            var environment = new ReportEnvironment(1234567, new MonitoraggioImmobiliare(654321))
            {
                //ResourceNameCover = 
            };


            //var _rendererFacade = new RendererFacade(environment);
            //_rendererFacade.Render(p)

            List<ReportSection> sections = GetSections();
            foreach (ReportSection r in sections)
                r.Render();
        }

        protected virtual List<ReportSection> GetSections()
        {
            List<ReportSection> sections = new List<ReportSection>();
            string reportName = GetType().Name;
            //TODO: populate from database by report name
            return sections;
        }
    }
}
