using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace XMLExtractor
{
    static class Utility
    {
        public static string PATH_XML = @"C:\Users\nazio\Desktop\Immobiliare Monitoraggio\responseCOD.xml";
        public static string connectionString = @"Data Source= bfdspuc01t.hp,1433; Database=ReportModeler2; User ID=userHP; Password=userHP;";
        public static string TEMPLATE_STRUTTURA_MODELLI_SELECT = "SELECT * FROM TemplateStrutturaModelli";
        public static string INSERT_TEMPLATE_STRUTTURA_MODELLI_SELECT =
            "INSERT INTO TemplateStrutturaModelli (ID, IdReport, IdModello, Capitolo_ChiaveLayout, IdParagrafo, Paragrafo_ChiaveLayout)";
        public static string DELETE_DB = "DELETE FROM dbo.REP_IMM_MON_Rows WHERE idREP_IMM_MON_Row >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_TableEvoluzione WHERE idREP_IMM_MON_TableEvoluzione >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_TableImposta WHERE idREP_IMM_MON_TableImposta >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_Columns WHERE idREP_IMM_MON_Column >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_TableCittaPrincipali WHERE idREP_IMM_MON_TableCittaPrincipale >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_CittaPrincipali WHERE idREP_IMM_MON_CittaPrincipale >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_Aspettative WHERE idREP_IMM_MON_Aspettativa >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_PuntiGrafico WHERE idREP_IMM_MON_PuntiGrafico >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_Grafici WHERE idREP_IMM_MON_Grafico >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_Legenda WHERE idREP_IMM_MON_Legenda >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_Item WHERE idREP_IMM_MON_Item >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_Image WHERE idREP_IMM_MON_Image >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_TestiParagrafo WHERE idREP_IMM_MON_TestoParagrafo >= 0 " +
            "DELETE FROM dbo.REP_IMM_MON_Pagine WHERE idREP_IMM_MON_Pagina >= 1 " +
            "DELETE FROM dbo.REP_IMM_MON_Template WHERE idREP_IMM_MON_Template >= 1 " +
            "DELETE FROM dbo.TemplateStrutturaModelli WHERE ID >= 501 AND ID <=530 " +
            "DELETE FROM dbo.Sezioni WHERE ID >= 201 AND ID <=220 " +
            "DELETE FROM dbo.Paragrafi WHERE ID >= 201 AND ID <=220 " +
            "DELETE FROM dbo.Capitoli WHERE ID >= 201 AND ID <=220 " +
            "DELETE FROM dbo.TestiCapitoli WHERE ID >= 181 " +
            "DELETE FROM dbo.ClassiLayout WHERE IdChiaveLayout >= 3001 AND IdChiaveLayout<=3030 " +
            "DELETE FROM dbo.ClassiLayout WHERE IdChiaveLayout >= 3501 AND IdChiaveLayout<=3530 ";
        public static int CHIAVE_LAYOUT_SECTION = 1;
        public static int CHIAVE_LAYOUT_CHAPTER = 1;
        public static int CHIAVE_LAYOUT_SECTION_NUCLEO = 1;
        public static int CHIAVE_LAYOUT_CHAPTER_NUCLEO = 1;
        public static int ID_PAGE = 1;
        public static int ID_REP_IMM_MON_ROW = 1;
        public static int ID_REP_IMM_MON_COLUMN = 1;
        public static int ID_SECTION = 200;
        public static int TEMPLATE_STRUTTURA_MODELLO = 501;
        public static int ID_REP_IMM_MON_TEMPLATE = 1;

        public static string RemoveDiacritics(string text)
        {
            var normalizedString = text.Normalize(NormalizationForm.FormD);
            var stringBuilder = new StringBuilder();

            foreach (var c in normalizedString)
            {
                var unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c);
                if (unicodeCategory != UnicodeCategory.NonSpacingMark)
                {
                    stringBuilder.Append(c);
                }
            }

            return stringBuilder.ToString().Normalize(NormalizationForm.FormC);
        }

    }
}
