<Window x:Class="ReAct_PME.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ReAct_PME"
        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        mc:Ignorable="d"
        Title="Assistant intelligent - MainMenu"
        MinHeight="620" MinWidth="600"
        Height="620" Width="600"
        Closing="Window_Closing"
        Background="{DynamicResource MaterialDesign.Brush.Primary.Dark.Foreground}">
    <Window.Triggers>
        <EventTrigger RoutedEvent="Window.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="TxtMessage"
                                 Storyboard.TargetProperty="Opacity"
                                 From="0" To="1" Duration="0:0:1" />
                    <ThicknessAnimation Storyboard.TargetName="TxtMessage"
                                    Storyboard.TargetProperty="Margin"
                                    From="0,100,0,0" To="0,40,0,40"
                                    Duration="0:0:1" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Window.Triggers>
    
    
    <Grid Margin="16">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- Menu principal -->
        <Menu Grid.Row="0" Background="{DynamicResource MaterialDesignPaper}">
            <MenuItem x:Name="Mnu_Mails" Header="📧 Mails">
                <MenuItem x:Name="Mnu_ListeMails" Header="Liste mails non lus" Click="BtnListeEmails_Click"/>
                <MenuItem x:Name="Mnu_ListeMailsSend" Header="Liste mails envoyés" Click="BtnListeEmailsSend_Click"/>
                <MenuItem x:Name="Mnu_GenerateMail" Header="Générer un email" Click="BtnGenerateEmail_Click"/>
            </MenuItem>
            <MenuItem x:Name="Mnu_CV" Header="📄 CV">
                <MenuItem x:Name="Mnu_RechercheCV" Header="Recherche CV" Click="BtnRechercheCV_Click"/>
                <MenuItem x:Name="Mnu_GenererCV" Header="Générer un CV" Click="BtnGenererCV_Click"/>
            </MenuItem>
            <MenuItem x:Name="Mnu_Documents" Header="🏢 Documents">
                <MenuItem x:Name="Mnu_Factures_PDF_to_XML" Header="Factures PDF to XML" Click="BtnFactures_PDF_to_XML_Click"/>
                <MenuItem x:Name="Mnu_MakeTF_From_DSF" Header="TF From DSF" Click="BtnMakeTF_From_DSF_Click"/>
                <MenuItem x:Name="Mnu_ResumeAudio" Header="Résumer un audio" Click="BtnResumeAudio_Click"/>
            </MenuItem>
            <MenuItem x:Name="Mnu_Chat"  Header="💬 Chat-Room">
                <MenuItem x:Name="Mnu_CHAT_LLM" Header="Chat-LLM" Click="BtnChatRoom_Click"/>
                <MenuItem x:Name="Mnu_CHAT_RAG" Header="RAG" Click="BtnRAG_Click"/>
                <MenuItem x:Name="Mnu_CHAT_GenerateImg" Header="Génération images" Click="BtnGenerateImg_Click"/>
                <MenuItem x:Name="Mnu_CHAT_LLM_CODER" Header="Chat-LLM-Coder" Click="BtnChatRoomCoder_Click"/>
            </MenuItem>
            <MenuItem x:Name="Mnu_Parametres" Header="⚙️ Paramètres">
                <MenuItem x:Name="Mnu_ParametresCompteMail" Header="Mails" Click="BtnParametresCompteMail_Click"/>
                <MenuItem x:Name="Mnu_ParametresCheckMails" Header="Checker les Emails au démarrage" Click="BtnParametresCheckMail_Click"/>
                <MenuItem x:Name="Mnu_ParametresFactures" Header="Factures PDF to XML" Click="BtnParametresFactures_Click"/>
                <MenuItem x:Name="Mnu_ParametresRAG" Header="RAG" Click="BtnParametresRAG_Click"/>
                <MenuItem x:Name="Mnu_ParametresQdrant" Header="Qdrant" Click="BtnParametresQdrant_Click"/>
                <MenuItem Header="Ollama" Click="BtnParametresOllama_Click"/>
                <MenuItem x:Name="Mnu_ParametresGenerationImages" Header="Generation images" Click="BtnParametresGenerateImg_Click"/>
                <MenuItem x:Name="Mnu_ParametresFooocus" Header="Fooocus" Click="BtnParametresFooocus_Click"/>
                <MenuItem x:Name="Mnu_ParametresWhisper" Header="Whisper" Click="BtnParametresWhisper_Click"/>
                <MenuItem Header="Logs" Click="BtnParametresLogs_Click"/>
                <MenuItem x:Name="Mnu_ParametresTF_From_DSF" Header="TF From DSF" Click="BtnParametresTF_From_DSF_Click"/>
                <MenuItem Header="Prompts" Click="BtnParametresPrompts_Click"/>
                <MenuItem Header="Reconnaissance faciale" Click="BtnParametresFaceRecognition_Click"/>
                <MenuItem Header="Modèles" x:Name="Mnu_paramModeles">
                    <MenuItem Header="LLM Chatbot" Click="BtnParametresModelesLLM_Click"/>
                    <MenuItem Header="Analyse Mails" Click="BtnParametresModelesAnalyseMails_Click"/>
                    <MenuItem Header="Génération Mails" Click="BtnParametresModelesGenerationMails_Click"/>
                    <MenuItem Header="Analyse CV et Fiche de mission" Click="BtnParametresModelesAnalyseCVMission_Click"/>
                    <MenuItem Header="Générer CV avec autre modèle" Click="BtnParametresModelesCV_to_XML_Click"/>
                    <MenuItem Header="RAG" Click="BtnParametresModelesRAG_Click"/>
                    <MenuItem Header="Resumé de documents" Click="BtnParametresModelesResumeDocuments_Click"/>
                    <MenuItem Header="Extraire infos d'un PDF en XML" Click="BtnParametresModelesPdfToXml_Click"/>
                    <MenuItem Header="Interprétation d'images" Click="BtnParametresModelesInterpretationImages_Click"/>
                    <MenuItem Header="Génération de prompt pour Fooocus" Click="BtnParametresModelesPromptGenerationFooocus_Click"/>
                    <MenuItem Header="TF from DSF" Click="BtnParametresModelesMakeTF_From_DSF_Click"/>
                    <MenuItem Header="LLM Coder" Click="BtnParametresModelesLLM_Coder_Click"/>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="❓ Aide">
                <MenuItem Header="Voir les logs" Click="VoirLogs_Click"/>
                <MenuItem Header="Reconnaissance faciale">
                    <MenuItem Header="Qui suis-je ?" Click="WhoIAmPredictLive_Click"/>
                    <MenuItem Header="Prendre une photo" Click="WhoIAmPhoto_Click"/>
                    <MenuItem Header="Entrainement" Click="WhoIAmTraining_Click"/>
                    <MenuItem Header="Tests" Click="WhoIAmTest_Click"/>
                </MenuItem>
                <MenuItem Header="En savoir plus sur Ollama" Click="Button_Click"/>
                <MenuItem Header="À propos de Agent ReAct PME" Click="APropos_Click"/>
                <MenuItem Header="Saisir le code licence" Click="SaisirLicence_Click"/>
                <Separator/>
                <MenuItem Header="Quitter" Click="Quitter_Click"/>
            </MenuItem>
        </Menu>

        <!-- Contenu principal -->
        <StackPanel Grid.Row="1" Margin="0,0,0,16">
            <TextBlock x:Name="TxtMessage" Text="Assistant intelligent d'aide à la gestion du quotidien !" 
                       FontSize="22" FontWeight="Medium" Margin="0,0,0,26"/>
            <TextBlock x:Name="TxtMessageNom" Text="..." 
                       FontSize="18" FontWeight="Medium" Margin="0,0,0,30"/>
            <!-- Statuts -->
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal" Margin="0,4">
                    <materialDesign:PackIcon Kind="Robot" Width="24" Height="24" Margin="0,0,8,0"/>

                    <Ellipse x:Name="OllamaStatus"
                         Width="20" Height="20"
                         Fill="Gray"
                         Stroke="Black"
                         StrokeThickness="1"
                         Margin="10,0">
                        <Ellipse.Effect>
                            <DropShadowEffect Color="BlueViolet"
                              BlurRadius="10"
                              ShadowDepth="0"
                              Opacity="0.6"/>
                        </Ellipse.Effect>
                        <Ellipse.Triggers>
                            <EventTrigger RoutedEvent="Ellipse.Loaded">
                                <BeginStoryboard>
                                    <Storyboard x:Name="PulseStoryboard1" RepeatBehavior="Forever" AutoReverse="True">
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                     From="1" To="0.6"
                                     Duration="0:0:1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Ellipse.Triggers>
                    </Ellipse>

                    <TextBlock x:Name="txtOllamaStatus" Text="Assistant d'analyse OnDemand" VerticalAlignment="Center" FontWeight="Medium"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,4">
                    <materialDesign:PackIcon Kind="RobotIndustrial" Width="24" Height="24" Margin="0,0,8,0"/>
                    <Ellipse x:Name="OllamaBatchStatus"
                         Width="20" Height="20"
                         Fill="Gray"
                         Stroke="Black"
                         StrokeThickness="1"
                         Margin="10,0">
                        <Ellipse.Effect>
                            <DropShadowEffect Color="BlueViolet"
                              BlurRadius="10"
                              ShadowDepth="0"
                              Opacity="0.6"/>
                        </Ellipse.Effect>
                        <Ellipse.Triggers>
                            <EventTrigger RoutedEvent="Ellipse.Loaded">
                                <BeginStoryboard>
                                    <Storyboard x:Name="PulseStoryboard2" RepeatBehavior="Forever" AutoReverse="True">
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                     From="1" To="0.6"
                                     Duration="0:0:1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Ellipse.Triggers>
                    </Ellipse>

                    <TextBlock x:Name="txtOllamaBatchStatus" Text="Assistant d'analyse Batch" VerticalAlignment="Center" FontWeight="Medium"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,4">
                    <materialDesign:PackIcon x:Name="FooocusIcone" Kind="Brush" Width="24" Height="24" Margin="0,0,8,0"/>
                    <Ellipse x:Name="FooocusStatus"
                         Width="20" Height="20"
                         Fill="Gray"
                         Stroke="Black"
                         StrokeThickness="1"
                         Margin="10,0">
                        <Ellipse.Effect>
                            <DropShadowEffect Color="BlueViolet"
                              BlurRadius="10"
                              ShadowDepth="0"
                              Opacity="0.6"/>
                        </Ellipse.Effect>
                        <Ellipse.Triggers>
                            <EventTrigger RoutedEvent="Ellipse.Loaded">
                                <BeginStoryboard>
                                    <Storyboard x:Name="PulseStoryboard3" RepeatBehavior="Forever" AutoReverse="True">
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                     From="1" To="0.6"
                                     Duration="0:0:1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Ellipse.Triggers>
                    </Ellipse>
                    <TextBlock x:Name="TxtFooocusStatus" Text="Assistant créatif" VerticalAlignment="Center" FontWeight="Medium"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,4">
                    <materialDesign:PackIcon x:Name="WhisperIcone" Kind="Microphone" Width="24" Height="24" Margin="0,0,8,0"/>
                    <Ellipse x:Name="WhisperStatus"
                         Width="20" Height="20"
                         Fill="Gray"
                         Stroke="Black"
                         StrokeThickness="1"
                         Margin="10,0">
                        <Ellipse.Effect>
                            <DropShadowEffect Color="BlueViolet"
                              BlurRadius="10"
                              ShadowDepth="0"
                              Opacity="0.6"/>
                        </Ellipse.Effect>
                        <Ellipse.Triggers>
                            <EventTrigger RoutedEvent="Ellipse.Loaded">
                                <BeginStoryboard>
                                    <Storyboard x:Name="PulseStoryboard4" RepeatBehavior="Forever" AutoReverse="True">
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                     From="1" To="0.6"
                                     Duration="0:0:1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Ellipse.Triggers>
                    </Ellipse>
                    <TextBlock x:Name="TxtWhisperStatus" Text="Assistant Transcribe" VerticalAlignment="Center" FontWeight="Medium"/>
                </StackPanel>

                <StackPanel Orientation="Horizontal" Margin="0,4">
                    <materialDesign:PackIcon x:Name="QdrantIcone" Kind="MathCompassVariant" Width="24" Height="24" Margin="0,0,8,0"/>
                    <Ellipse x:Name="QdrantStatus"
                         Width="20" Height="20"
                         Fill="Gray"
                         Stroke="Black"
                         StrokeThickness="1"
                         Margin="10,0">
                        <Ellipse.Effect>
                            <DropShadowEffect Color="BlueViolet"
                              BlurRadius="10"
                              ShadowDepth="0"
                              Opacity="0.6"/>
                        </Ellipse.Effect>
                        <Ellipse.Triggers>
                            <EventTrigger RoutedEvent="Ellipse.Loaded">
                                <BeginStoryboard>
                                    <Storyboard x:Name="PulseStoryboard5" RepeatBehavior="Forever" AutoReverse="True">
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity"
                                     From="1" To="0.6"
                                     Duration="0:0:1" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </Ellipse.Triggers>
                    </Ellipse>
                    <TextBlock x:Name="TxtQdrantStatus" Text="Assistant vectoriel" VerticalAlignment="Center" FontWeight="Medium"/>
                </StackPanel>
            </StackPanel>

            <!-- Annonce -->
            <TextBlock x:Name="TxtAnnonce" Text="Annonce" FontStyle="Italic" Margin="0,50,0,0"/>

            <!-- Boutons -->
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
                <Button x:Name="BtnParler" Content="Parler" Style="{DynamicResource MaterialDesignFlatButton}" Click="BtnParler_Click" Margin="100,0,10,0"/>
                <Button x:Name="BtnStopParler" Content="Stop Parler" Style="{DynamicResource MaterialDesignFlatButton}" Click="BtnStopParler_Click" Margin="10,0,100,0"/>


                <Button Content="Vérifier les services"
                    Click="ButtonRefresh_Click"
                    Style="{DynamicResource SimpleButton}" Margin="0,0,10,0" Height="23" Width="110" />
                <Button Content="Who I Am ?"
                    Click="ButtonWhoIAm_Click"
                    Style="{DynamicResource SimpleButton}" Margin="0,0,10,0" Height="23" Width="110" />
                <Button Content="Quitter"
                    Click="ButtonQuit_Click"
                    Style="{DynamicResource SimpleButton}" Width="50" />
           </StackPanel>
            
        </StackPanel>

        <!-- Snackbar pour notifications -->
        <materialDesign:Snackbar x:Name="MainSnackbar" Grid.Row="2"
                         MessageQueue="{Binding SnackbarQueue}" />
    </Grid>
</Window>
