<?xml version="1.0" encoding="utf-8"?>
<ContentDialog
    x:Class="NickvisionTagger.WinUI.Views.LyricsDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:NickvisionTagger.WinUI.Views"
    xmlns:nickvision="using:NickvisionTagger.WinUI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:wct="using:CommunityToolkit.WinUI.Controls"
    mc:Ignorable="d" Style="{StaticResource DefaultContentDialogStyle}"
    DefaultButton="Primary" Loaded="Dialog_Loaded">

    <ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Auto" MinWidth="600" SizeChanged="ScrollViewer_SizeChanged">
        <StackPanel x:Name="StackPanel" Orientation="Vertical" Spacing="6">
            <TextBlock x:Name="LblConfigure" Style="{StaticResource NavigationViewItemHeaderTextStyle}"/>
            
            <wct:SettingsCard x:Name="CardType">
                <wct:SettingsCard.HeaderIcon>
                    <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE7BC;"/>
                </wct:SettingsCard.HeaderIcon>

                <ComboBox x:Name="CmbType" SelectionChanged="CmbType_SelectionChanged"/>
            </wct:SettingsCard>

            <wct:SettingsCard x:Name="CardLanguageCode">
                <wct:SettingsCard.HeaderIcon>
                    <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xF2B7;"/>
                </wct:SettingsCard.HeaderIcon>

                <TextBox x:Name="TxtLanguageCode" Width="320"/>
            </wct:SettingsCard>

            <wct:SettingsCard x:Name="CardDescription">
                <wct:SettingsCard.HeaderIcon>
                    <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE15F;"/>
                </wct:SettingsCard.HeaderIcon>

                <TextBox x:Name="TxtDescription" Width="320"/>
            </wct:SettingsCard>

            <wct:SettingsCard x:Name="CardOffset">
                <wct:SettingsCard.HeaderIcon>
                    <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE916;"/>
                </wct:SettingsCard.HeaderIcon>

                <StackPanel Orientation="Horizontal" Spacing="6">
                    <TextBox x:Name="TxtOffset" Width="274" TextChanged="TxtOffset_TextChanged"/>

                    <Button x:Name="BtnApplyOffset" Height="32" VerticalAlignment="Center" IsEnabled="False" Click="ApplyOffset">
                        <Button.Content>
                            <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" FontSize="16" Glyph="&#xE73E;"/>
                        </Button.Content>
                    </Button>
                </StackPanel>
            </wct:SettingsCard>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <TextBlock x:Name="LblEdit" VerticalAlignment="Center" Style="{StaticResource NavigationViewItemHeaderTextStyle}"/>

                <StackPanel x:Name="SyncControls" Grid.Column="1" Orientation="Horizontal" Spacing="6">
                    <Button x:Name="BtnAddSyncLyric">
                        <Button.Content>
                            <StackPanel Orientation="Horizontal" Spacing="6">
                                <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" FontSize="16" Glyph="&#xE710;"/>

                                <TextBlock x:Name="LblBtnAddSyncLyric" TextWrapping="WrapWholeWords"/>
                            </StackPanel>
                        </Button.Content>

                        <Button.Flyout>
                            <Flyout x:Name="FlyoutAddSyncLyric" Placement="Bottom">
                                <StackPanel Orientation="Vertical" Spacing="6">
                                    <TextBox x:Name="TxtAddSyncLyric" MinWidth="200" TextChanged="TxtAddSyncLyric_TextChanged"/>

                                    <Button x:Name="BtnAddSyncLyricConfirm" Style="{ThemeResource AccentButtonStyle}" Click="AddSyncLyric"/>
                                </StackPanel>
                            </Flyout>
                        </Button.Flyout>
                    </Button>

                    <Button x:Name="BtnClearAllSyncLyrics" Height="32" Click="ClearAllSyncLyrics">
                        <Button.Content>
                            <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" FontSize="16" Glyph="&#xE107;"/>
                        </Button.Content>
                    </Button>

                    <Button x:Name="BtnImportLRC" Height="32" Click="ImportSyncFromLRC">
                        <Button.Content>
                            <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" FontSize="16" Glyph="&#xE1A5;"/>
                        </Button.Content>
                    </Button>

                    <Button x:Name="BtnExportLRC" Height="32" Click="ExportSyncToLRC">
                        <Button.Content>
                            <FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" FontSize="16" Glyph="&#xE118;"/>
                        </Button.Content>
                    </Button>
                </StackPanel>
            </Grid>

            <InfoBar x:Name="InfoBar" IsOpen="False"/>

            <nickvision:ViewStack x:Name="EditViewStack">
                <nickvision:ViewStack.Pages>
                    <nickvision:ViewStackPage PageName="Unsync">
                        <TextBox x:Name="TxtUnsync" MinHeight="300" TextWrapping="Wrap" AcceptsReturn="True" IsSpellCheckEnabled="True"/>
                    </nickvision:ViewStackPage>

                    <nickvision:ViewStackPage PageName="Sync">
                        <StackPanel x:Name="ListSync" Orientation="Vertical" Spacing="6"/>
                    </nickvision:ViewStackPage>
                </nickvision:ViewStack.Pages>
            </nickvision:ViewStack>
        </StackPanel>
    </ScrollViewer>
</ContentDialog>
