<UserControl x:Class="ScreenToGif.UserControls.GfycatPanel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:n="clr-namespace:ScreenToGif.Controls"
             xmlns:u="clr-namespace:ScreenToGif.Util"
             mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="320"
             x:Name="ThisPanel" Loaded="Panel_Loaded">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <n:StatusBand Grid.Row="0" x:Name="StatusBand"/>

        <Expander Grid.Row="1" Header="{DynamicResource S.Options.Upload.Preset.Details}" IsExpanded="True">
            <Grid Margin="10,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Preset.Name}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                <n:ExtendedTextBox Grid.Row="0" Grid.Column="1" x:Name="NameTextBox" Text="{Binding Title}" Margin="5,3" MaxLength="50" IsObligatory="True"/>

                <TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Preset.Description}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                <n:ExtendedTextBox Grid.Row="1" Grid.Column="1" Text="{Binding Description}" MinHeight="23" Margin="5,3" VerticalContentAlignment="Top" TextWrapping="Wrap" MaxLength="100"/>
                
                <TextBlock Grid.Row="2" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Preset.Mode}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                <ComboBox Grid.Row="2" Grid.Column="1"  Margin="5,3" VerticalContentAlignment="Center" SelectedValuePath="Tag" SelectedValue="{Binding IsAnonymous}">
                    <ComboBoxItem Content="{DynamicResource S.Options.Upload.Preset.Mode.Anonymous}" Tag="True"/>
                    <ComboBoxItem Content="{DynamicResource S.Options.Upload.Preset.Mode.Authenticated}" Tag="False"/>
                </ComboBox>
            </Grid>
        </Expander>

        <Expander Grid.Row="2" Header="{DynamicResource S.Options.Upload.Preset.Authorization}" IsExpanded="True" Visibility="{Binding IsAnonymous, Converter={StaticResource InvertedBoolToVisibility}}">
            <Grid Margin="10,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Preset.Username}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                <n:ExtendedTextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" x:Name="UserTextBox" Margin="5,3" MaxLength="50"/>

                <TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Preset.Password}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                <PasswordBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" x:Name="PasswordTextBox" Margin="5,3" MaxLength="50"/>

                <TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,3" Text="{Binding Status}" HorizontalAlignment="Center" VerticalAlignment="Center"
                           TextWrapping="Wrap" Foreground="{DynamicResource Element.Foreground.Gray150}"/>
                
                <n:ExtendedButton Grid.Row="2" Grid.Column="2" Text="{DynamicResource S.Options.Upload.Preset.Authorize}" Icon="{StaticResource Vector.Ok}" 
                                  ContentWidth="16" ContentHeight="16" Margin="3" Click="AuthorizeButton_Click"/>
                
                <Grid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" Margin="10,10,5,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Border Grid.Column="0" Width="15" Height="15" Background="{StaticResource Vector.Info}" Opacity="{DynamicResource Element.Opacity}"/>
                    <TextBlock Grid.Column="1" Text="{DynamicResource S.Options.Upload.Preset.NotStored}" Foreground="{DynamicResource Element.Foreground.Detail}" 
                               FontStyle="Italic" FontSize="12" Padding="3" TextWrapping="WrapWithOverflow"/>
                </Grid>
            </Grid>
        </Expander>
        
        <Expander Grid.Row="3" Header="{DynamicResource S.Options.Upload.Preset.Options}" IsExpanded="True">
            <Grid Margin="10,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <n:ExtendedCheckBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" x:Name="UseDirectCheckBox" Text="{DynamicResource S.Options.Upload.Preset.Direct}" Margin="5,3"
                                    IsChecked="{Binding UseDirectLinks, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                
                <TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Preset.Gfycat.UrlType}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"
                           Visibility="{Binding ElementName=UrlComboBox, Path=Visibility}"/>
                <ComboBox Grid.Row="1" Grid.Column="1" x:Name="UrlComboBox" Margin="5,3,3,3" Height="23" SelectedValuePath="Tag" SelectedValue="{Binding UrlType, Mode=TwoWay}"
                          Visibility="{Binding UseDirectLinks, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource Bool2Visibility}}">
                    <ComboBoxItem Tag="{x:Static u:Export.Mp4}" Content="Mp4"/>
                    <ComboBoxItem Tag="{x:Static u:Export.Webm}" Content="Webm"/>
                    <ComboBoxItem Tag="{x:Static u:Export.Gif}" Content="Gif"/>
                </ComboBox>

                <n:ExtendedCheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="AskMeCheckBox" Text="{DynamicResource S.Options.Upload.Preset.Gfycat.AskMe}" Margin="5,5,5,3"
                                    IsChecked="{Binding AskForDetails, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            </Grid>
        </Expander>

        <Expander Grid.Row="4" Header="{DynamicResource S.Options.Upload.Preset.Gfycat.Defaults}" IsExpanded="True">
            <Grid Margin="10,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Pick.Details.Title}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                <n:ExtendedTextBox Grid.Row="0" Grid.Column="1" x:Name="TitleTextBox" Text="{Binding DefaultTitle}" Margin="5,3" MaxLength="50"/>

                <TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Pick.Details.Description}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                <n:ExtendedTextBox Grid.Row="1" Grid.Column="1" x:Name="DescriptionTextBox" Text="{Binding DefaultDescription}" Margin="5,3" MaxLength="50"/>

                <TextBlock Grid.Row="2" Grid.Column="0" Text="{DynamicResource S.Options.Upload.Pick.Details.Tags}" VerticalAlignment="Center" Foreground="{DynamicResource Element.Foreground.Medium}"/>
                <n:ExtendedTextBox Grid.Row="2" Grid.Column="1" x:Name="TagsTextBox" Text="{Binding DefaultTags}" Margin="5,3" MaxLength="50" Watermark="{DynamicResource S.Options.Upload.Pick.Details.Tags.Info}"/>

                <n:ExtendedCheckBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="IsPrivateCheckBox" Text="{DynamicResource S.Options.Upload.Pick.Details.Private}" Margin="5,5,5,3"
                                    IsChecked="{Binding DefaultIsPrivate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            </Grid>
        </Expander>
    </Grid>
</UserControl>