using System.Data;
using Consulenza.ReportCommon;
using System;

namespace Consulenza.ReportWriter.Manager.Integration
{
    /// <summary>
    /// Rappresenta la classe di Integrazione di layout.
    /// </summary>
    public abstract class IntegrationLayout
    {
        public int Id { get; set; }
        public int IntegrazioneChiaveLayout { get; set; }
        public bool DuplicaCapitolo { get; set; }
        public bool DuplicaParagrafo { get; set; }
        public bool DuplicaSezione { get; set; }
        public DataRow Row { get; set; }
        public DataTable ReportStructure { get; set; }
        public DataSet ReportDs { get; set; }
        public int iRow { get; set; }
        public ReportEnvironment Environment { get; set; }

        //protected IntegrationLayout(DataTable structure, DataRow row, ReportEnvironment environment)
        //{
        //    Id = Convert.ToInt32(row["Id"]);
        //    IntegrazioneChiaveLayout = Convert.ToInt32(row["Integrazione_ChiaveLayout"]);
        //    Row = row;
        //    ReportStructure = structure;
        //    Environment = environment;            
        //}

        protected IntegrationLayout(DataTable structure, DataRow row, ReportEnvironment environment, DataSet reportDs = null, int nRow = 0)
        {
            Id = Convert.ToInt32(row["Id"]);
            IntegrazioneChiaveLayout = Convert.ToInt32(row["Integrazione_ChiaveLayout"]);
            Row = row;
            ReportStructure = structure;
            Environment = environment;
            ReportDs = reportDs;
            iRow = nRow;
        }

        public abstract DataTable RecalculateStructure();

    }
}
