namespace ToolsServices
{
    public static class FichiersInternesService
    {
        #region Variables privées
        private static string _DossierParametres = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Parametres");
        private static string _DossierVectors = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Vectors");
        private static string _DossierListesItems = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ListesItems");
        private static string _DossierPrompts = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Prompts");
        #endregion

        #region Variables publiques
        
        public static string DossierLogs = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");

        public static string ParamsLicence { get; } = Path.Combine(_DossierParametres, "params.txt");

        public static string ParamsFaceRecognition = Path.Combine(_DossierParametres, "paramsFaceRecognition.txt");
        public static string ParamsLancerCheckMails{ get; } = Path.Combine(_DossierParametres, "paramsLancerCheckMails.txt");
        public static string ParamsGenerationCV { get; } = Path.Combine(_DossierParametres, "paramsGenerationCV.txt");
        public static string ParamsRechercheCV { get; } = Path.Combine(_DossierParametres, "paramsRechercheCV.txt");
        public static string ParamsFactures { get; } = Path.Combine(_DossierParametres, "paramsFactures.txt");
        public static string ParamsTF_From_DSF { get; } = Path.Combine(_DossierParametres, "paramsTF_From_DSF.txt");
        public static string ParamsMail { get; } = Path.Combine(_DossierParametres, "paramsMail.txt");
        public static string ParamsOllama { get; } = Path.Combine(_DossierParametres, "paramsOllama.txt");
        public static string ParamsQdrant { get; } = Path.Combine(_DossierParametres, "paramsQdrant.txt");
        public static string ParamsModeles { get; } = Path.Combine(_DossierParametres, "models.config.json");
        public static string ParamsApiExterne { get; } = Path.Combine(_DossierParametres, "paramsApiExterne.txt");
        public static string ParamsRAG { get; } = Path.Combine(_DossierParametres, "paramsRAG.txt");
        public static string ParamsGenerateImg { get; } = Path.Combine(_DossierParametres, "paramsGenerateImg.txt");
        public static string ParamsFooocus { get; } = Path.Combine(_DossierParametres, "paramsFooocus.txt");
        public static string ParamsLogs { get; } = Path.Combine(_DossierParametres, "paramsLogs.txt");
        public static string ParamsWhisper { get; } = Path.Combine(_DossierParametres, "paramsWhisper.txt");

        public static string EmailsSensibiliteTon { get; } = Path.Combine(_DossierParametres, "EmailsSensibiliteTon.txt");
        public static string EmailsSensibilitePosture { get; } = Path.Combine(_DossierParametres, "EmailsSensibilitePosture.txt");
        public static string EmailsSensibiliteCouleur { get; } = Path.Combine(_DossierParametres, "EmailsSensibiliteCouleur.txt");
        public static string EmailsSensibiliteNiveauDetail { get; } = Path.Combine(_DossierParametres, "EmailsSensibiliteNiveauDetail.txt");

        public static string VectorsCV { get; } = Path.Combine(_DossierVectors, "vectorsCV.json");
        public static string VectorsDocsRAG { get; } = Path.Combine(_DossierVectors, "vectorsDocsRAG.json");
        public static string VectorsDocsCHAT { get; } = Path.Combine(_DossierVectors, "vectorsDocsCHAT.json");
        public static string VectorsMails { get; } = Path.Combine(_DossierVectors, "vectorsMails.json");

        public static string ListeMails { get; } = Path.Combine(_DossierListesItems, "listeMails.json"); 
        public static string ListeMailsSend { get; } = Path.Combine(_DossierListesItems, "listeMailsSend.json");
        public static string ListeRechercheCV { get; } = Path.Combine(_DossierListesItems, "listeRechercheCV.json");
        #endregion

        #region Classe interne pour les fichiers de prompts
        public static class PromptFiles
        {
            public static string ReActAgent_PromptSystem_LLM_Coder { get; } = Path.Combine(_DossierPrompts, "ReActAgent.PromptSystem_LLM_Coder.txt");
            public static string ReActAgent_GenerateImage { get; } = Path.Combine(_DossierPrompts, "ReActAgent.GenerateImage.txt");
            public static string ReActAgent_GenerateImageV2 { get; } = Path.Combine(_DossierPrompts, "ReActAgent.GenerateImageV2.txt");
            public static string ReActAgent_RechercheRAG { get; } = Path.Combine(_DossierPrompts, "ReActAgent.RechercheRAG.txt");
            public static string ReActAgent_SummarizeDoc { get; } = Path.Combine(_DossierPrompts, "ReActAgent.SummarizeAsyncDoc.txt");
            public static string ReActAgent_SummarizeIntegralLongDoc { get; } = Path.Combine(_DossierPrompts, "ReActAgent.SummarizeIntegralLongDoc.txt");
            public static string ReActAgent_SummarizeIntegralLongDoc_Final { get; } = Path.Combine(_DossierPrompts, "ReActAgent.SummarizeIntegralLongDoc_Final.txt");
            
            public static string GenererCVService_GenerateOneCV_Extract { get; } = Path.Combine(_DossierPrompts, "GenererCVService.GenerateOneCV_Extract.txt");
            public static string GenererCVService_GenerateOneCV_Format { get; } = Path.Combine(_DossierPrompts, "GenererCVService.GenerateOneCV_Format.txt");
            
            public static string RechercheCVService_RechercheCV_Analyse { get; } = Path.Combine(_DossierPrompts, "RechercheCVService.RechercheCV_Analyse.txt");
            public static string RechercheCVService_RechercheCV_Generate { get; } = Path.Combine(_DossierPrompts, "RechercheCVService.RechercheCV_Generate.txt");

            public static string EmailService_Generer_Mail { get; } = Path.Combine(_DossierPrompts, "EmailService.Generer_Mail.txt");

            public static string EmailService_AnalyserMail_Resume { get; } = Path.Combine(_DossierPrompts, "EmailService.AnalyserMail_Resume.txt");
            public static string EmailService_AnalyserMail_Resume_PJ { get; } = Path.Combine(_DossierPrompts, "EmailService.AnalyserMail_Resume_PJ.txt");
            public static string EmailService_AnalyserMail_Categorie { get; } = Path.Combine(_DossierPrompts, "EmailService.AnalyserMail_Categorie.txt");
            public static string EmailService_AnalyserMail_Strategie { get; } = Path.Combine(_DossierPrompts, "EmailService.AnalyserMail_Strategie.txt");
            public static string EmailService_AnalyserMail_Reponse { get; } = Path.Combine(_DossierPrompts, "EmailService.AnalyserMail_Reponse.txt");
            public static string EmailService_AnalyserMail_Reponse_PJ { get; } = Path.Combine(_DossierPrompts, "EmailService.AnalyserMail_Reponse_PJ.txt");

            public static string EmailSendService_AnalyserMail_BesoinReponse { get; } = Path.Combine(_DossierPrompts, "EmailSendService.AnalyserMail_BesoinReponse.txt");
            public static string EmailSendService_AnalyserMail_AllPointsChecked { get; } = Path.Combine(_DossierPrompts, "EmailSendService.AnalyserMail_AllPointsChecked.txt");
            public static string EmailSendService_AnalyserMail_Relance { get; } = Path.Combine(_DossierPrompts, "EmailSendService.AnalyserMail_Relance.txt");

            public static string TF_From_DSFService_GenereTF { get; } = Path.Combine(_DossierPrompts, "TF_From_DSFService.GenereTF.txt");
           
            public static string FactureService_AnalyserFacture_Extract { get; } = Path.Combine(_DossierPrompts, "FactureService.AnalyserFacture_Extract.txt");

            public static string OllamaService_PromptSystem { get; } = Path.Combine(_DossierPrompts, "OllamaService.PromptSystem.txt");
            public static string TranscriptionAndResumeService_Resume { get; } = Path.Combine(_DossierPrompts, "TranscriptionAndResumeService.Resume.txt");
        }
        #endregion

        #region Méthodes publiques
        public static void VerifPath()
        {
            try
            {
                if (!Directory.Exists(_DossierParametres))
                {
                    LoggerService.LogDebug($"FichiersInternesService.VerifPath. Tentative de créé : {_DossierParametres}");
                    Directory.CreateDirectory(_DossierParametres);
                    LoggerService.LogInfo($"FichiersInternesService.VerifPath. répertoire créé : {_DossierParametres}");
                }

                if (!Directory.Exists(_DossierVectors))
                {
                    LoggerService.LogDebug($"FichiersInternesService.VerifPath. Tentative de créé : {_DossierVectors}");
                    Directory.CreateDirectory(_DossierVectors);
                    LoggerService.LogInfo($"FichiersInternesService.VerifPath. répertoire créé : {_DossierVectors}");
                }

                if (!Directory.Exists(_DossierListesItems))
                {
                    LoggerService.LogDebug($"FichiersInternesService.VerifPath. Tentative de créé : {_DossierListesItems}");
                    Directory.CreateDirectory(_DossierListesItems);
                    LoggerService.LogInfo($"FichiersInternesService.VerifPath. répertoire créé : {_DossierListesItems}");
                }

                if (!Directory.Exists(_DossierPrompts))
                {
                    LoggerService.LogDebug($"FichiersInternesService.VerifPath. Tentative de créé : {_DossierPrompts}");
                    Directory.CreateDirectory(_DossierPrompts);
                    LoggerService.LogInfo($"FichiersInternesService.VerifPath. répertoire créé : {_DossierPrompts}");
                }
            }
            catch (Exception ex)
            {
                LoggerService.LogError($"FichiersInternesService.VerifPath : {ex.Message}");

            }
        }
        #endregion
    }
}
