@using AIStudio.Assistants.Coding
@using AIStudio.Settings
@inherits SettingsDialogBase

<MudDialog>
    <TitleContent>
        <MudText Typo="Typo.h6" Class="d-flex align-center">
            <MudIcon Icon="@Icons.Material.Filled.Code" Class="mr-2" />
            @T("Assistant: Coding Options")
        </MudText>
    </TitleContent>
    <DialogContent>
        <MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
            <ConfigurationOption OptionDescription="@T("Preselect coding options?")" LabelOn="@T("Coding options are preselected")" LabelOff="@T("No coding options are preselected")" State="@(() => this.SettingsManager.ConfigurationData.Coding.PreselectOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Coding.PreselectOptions = updatedState)" OptionHelp="@T("When enabled, you can preselect the coding options. This is might be useful when you prefer a specific programming language or LLM model.")"/>
            <ConfigurationOption OptionDescription="@T("Preselect compiler messages?")" Disabled="@(() => !this.SettingsManager.ConfigurationData.Coding.PreselectOptions)" LabelOn="@T("Compiler messages are preselected")" LabelOff="@T("Compiler messages are not preselected")" State="@(() => this.SettingsManager.ConfigurationData.Coding.PreselectCompilerMessages)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.Coding.PreselectCompilerMessages = updatedState)" />
            <ConfigurationSelect OptionDescription="@T("Preselect a programming language")" Disabled="@(() => !this.SettingsManager.ConfigurationData.Coding.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Coding.PreselectedProgrammingLanguage)" Data="@ConfigurationSelectDataFactory.GetCommonCodingLanguagesData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Coding.PreselectedProgrammingLanguage = selectedValue)" OptionHelp="@T("Which programming language should be preselected for added contexts?")"/>
            @if (this.SettingsManager.ConfigurationData.Coding.PreselectedProgrammingLanguage is CommonCodingLanguages.OTHER)
            {
                <ConfigurationText OptionDescription="@T("Preselect another programming language")" Disabled="@(() => !this.SettingsManager.ConfigurationData.Coding.PreselectOptions)" Icon="@Icons.Material.Filled.Code" Text="@(() => this.SettingsManager.ConfigurationData.Coding.PreselectedOtherProgrammingLanguage)" TextUpdate="@(updatedText => this.SettingsManager.ConfigurationData.Coding.PreselectedOtherProgrammingLanguage = updatedText)"/>
            }
            <ConfigurationMinConfidenceSelection Disabled="@(() => !this.SettingsManager.ConfigurationData.Coding.PreselectOptions)" RestrictToGlobalMinimumConfidence="@true" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Coding.MinimumProviderConfidence)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Coding.MinimumProviderConfidence = selectedValue)"/>
            <ConfigurationProviderSelection Component="Components.CODING_ASSISTANT" Data="@this.availableLLMProviders" Disabled="@(() => !this.SettingsManager.ConfigurationData.Coding.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Coding.PreselectedProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Coding.PreselectedProvider = selectedValue)"/>
            <ConfigurationSelect OptionDescription="@T("Preselect one of your profiles?")" Disabled="@(() => !this.SettingsManager.ConfigurationData.Coding.PreselectOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.Coding.PreselectedProfile)" Data="@ConfigurationSelectDataFactory.GetProfilesData(this.SettingsManager.ConfigurationData.Profiles)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.Coding.PreselectedProfile = selectedValue)" OptionHelp="@T("Would you like to preselect one of your profiles?")"/>
        </MudPaper>
    </DialogContent>
    <DialogActions>
        <MudButton OnClick="@this.Close" Variant="Variant.Filled">Close</MudButton>
    </DialogActions>
</MudDialog>