<UserControl x:Class="NebulaAuth.View.LinkerView"
             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:local="clr-namespace:NebulaAuth.View"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800"
             Foreground="WhiteSmoke"
             FontFamily="{materialDesign:MaterialDesignFont}"
             MinHeight="640"
             MinWidth="400"
             Background="{DynamicResource WindowBackground}"
             d:DataContext="{d:DesignInstance other:LinkAccountVM}"
             FontSize="18">
    <d:DesignerProperties.DesignStyle>
        <Style TargetType="UserControl">
            <Setter Property="Background" Value="{DynamicResource WindowBackground}" />
        </Style>
    </d:DesignerProperties.DesignStyle>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>


        </Grid.RowDefinitions>
        <Grid.Resources>
            <Style  TargetType="materialDesign:PackIcon">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=StackPanel}, Path=Tag}" Value="False">
                        <Setter Property="Foreground" Value="IndianRed"/>
                        <Setter Property="Kind" Value="CheckBoxOutlineBlank"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=StackPanel}, Path=Tag}" Value="True">
                        <Setter Property="Foreground" Value="Green"/>
                        <Setter Property="Kind" Value="CheckBoxOutline"/>
                    </DataTrigger>
                </Style.Triggers>

            </Style>
            <Style TargetType="TextBlock">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=StackPanel}, Path=Tag}" Value="True">
                        <Setter Property="Foreground" Value="Gray"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <Grid Margin="10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <TextBlock FontStyle="Normal" Foreground="DarkGray" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Text="{Tr LinkerDialog.Title}"/>
            <Button Grid.Column="1" Width="30" Height="30" Style="{StaticResource MaterialDesignIconForegroundButton}" HorizontalAlignment="Right" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}">
                <materialDesign:PackIcon Kind="Close" Width="24" Height="24" Foreground="IndianRed"></materialDesign:PackIcon>
            </Button>
        </Grid>
        <Separator Background="DarkGray" Grid.Row="1"></Separator>
        <Grid Grid.Row="2" Margin="10,20,10,10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <ComboBox  Padding="10" FontSize="16" Style="{StaticResource  MaterialDesignOutlinedComboBox}" SelectedValue="{Binding SelectedProxy}" ItemsSource="{Binding Proxies}" materialDesign:HintAssist.Hint="{Tr LinkerDialog.Proxy}"  IsEnabled="{Binding IsPasswordFieldVisible}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock>
                        <Run Text="{Binding Key, Mode=OneWay}"/><Run Text=":"/>
                        <Run Text="{Binding Value.Address, Mode=OneWay}"/>
                        </TextBlock>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <Button  Grid.Column="1" IsEnabled="{Binding IsPasswordFieldVisible}" Margin="5,0,0,0" Command="{Binding ResetProxyCommand}" Content="{materialDesign:PackIcon Trash}"/>
        </Grid>
        <StackPanel Grid.Row="3" Orientation="Horizontal" Margin="10" Tag="{Binding IsLogin}">
            <materialDesign:PackIcon  Width="20" Height="20" VerticalAlignment="Center" Margin="0,0,5,0"/>
            <TextBlock Text="{Tr LinkerDialog.Authorization}"/>
        </StackPanel>
        <StackPanel Grid.Row="4" Orientation="Horizontal" Margin="10" Tag="{Binding IsEmailCode}">
            <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center"  Margin="0,0,5,0"/>
            <TextBlock Text="{Tr LinkerDialog.EmailCode}"/>
        </StackPanel>
        <StackPanel Grid.Row="5" Orientation="Horizontal" Margin="10" Tag="{Binding IsPhoneNumber}">
            <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center"  Margin="0,0,5,0"/>
            <TextBlock Text="{Tr LinkerDialog.PhoneNumber}"/>
        </StackPanel>
        <StackPanel Grid.Row="6" Orientation="Horizontal" Margin="10" Tag="{Binding IsEmailConfirmation}">
            <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center"  Margin="0,0,5,0"/>
            <TextBlock Text="{Tr LinkerDialog.EmailLink}"/>
        </StackPanel>
        <StackPanel Grid.Row="7" Orientation="Horizontal" Margin="10" Tag="{Binding IsLinkCode}">
            <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center"  Margin="0,0,5,0"/>
            <TextBlock Text="{Tr LinkerDialog.SmsOrCode}"/>
        </StackPanel>
        <StackPanel Grid.Row="8" Orientation="Horizontal" Margin="10" Tag="{Binding IsCompleted}">
            <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center"  Margin="0,0,5,0"/>
            <TextBlock Text="{Tr LinkerDialog.Completed}"/>
        </StackPanel>
        <Grid  Grid.Row="9" Margin="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBox Padding="10" Text="{Binding FieldText}" Visibility="{Binding IsFieldVisible, Converter={StaticResource BooleanToVisibilityConverter}}"  Style="{StaticResource MaterialDesignOutlinedTextBox}"  FontSize="16" Margin="0,0,0,10"></TextBox>
            <TextBox Grid.Row="1" Padding="10" Text="{Binding PassFieldText}" Visibility="{Binding IsPasswordFieldVisible, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignOutlinedTextBox}" FontSize="16"/>
            <GroupBox  Grid.Row="2" MaxWidth="400" BorderBrush="{StaticResource PrimaryHueMidBrush}" VerticalAlignment="Bottom" BorderThickness="1" Margin="0,10,0,0" Padding="5">
                <GroupBox.HeaderTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Tr LinkerDialog.Message}" FontSize="16" Foreground="GhostWhite"/>
                    </DataTemplate>
                </GroupBox.HeaderTemplate>
                <TextBlock Foreground="GhostWhite" FontSize="16" Text="{Binding HintText}"  HorizontalAlignment="Stretch" TextWrapping="Wrap"/>
            </GroupBox>
        </Grid>

        <Button Grid.Row="10" FontSize="18" Command="{Binding ProceedCommand}" Content="{Tr LinkerDialog.ProceedButton}"/>
    </Grid>
</UserControl>
