<UserControl x:Class="TeamViewerApi.Views.UsersView" 
             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:viewModels="clr-namespace:TeamViewerApi.ViewModels" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="500">
    <UserControl.DataContext>
        <viewModels:UsersViewModel />
    </UserControl.DataContext>
    
    <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="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0" Text="User" />
        <ComboBox Grid.Row="0" Grid.Column="1" 
                  Width="200px" 
                  ItemsSource="{Binding Users, Mode=OneWay}" 
                  SelectedItem="{Binding SelectedUser, Mode=TwoWay}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Style="{x:Null}" Text="{Binding Name, Mode=OneWay}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
        <CheckBox Grid.Row="0" Grid.Column="2" IsChecked="{Binding FullListOption, Mode=TwoWay}" Content="Get full" />
        <DockPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" 
                   Background="AliceBlue" />
        <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" FontWeight="Bold" Text="Current user" />

        <TextBlock Grid.Row="2" Grid.Column="0" Text="Id" />
        <TextBox Grid.Row="2" Grid.Column="1" Width="150px" IsReadOnly="True" Text="{Binding SelectedUser.UserId, Mode=TwoWay}" />
        <TextBlock Grid.Row="3" Grid.Column="0" Text="Name" />
        <TextBox Grid.Row="3" Grid.Column="1" Width="200px" Text="{Binding SelectedUser.Name, Mode=TwoWay}" />
        <TextBlock Grid.Row="4" Grid.Column="0" Text="Permissions" />
        <TextBox Grid.Row="4" Grid.Column="1" Width="200px" Text="{Binding SelectedUser.Permissions, Mode=TwoWay}" />
        <TextBlock Grid.Row="5" Grid.Column="0" Text="Is active" />
        <CheckBox Grid.Row="5" Grid.Column="1" IsChecked="{Binding SelectedUser.IsActive, Mode=TwoWay}" />
        <TextBlock Grid.Row="6" Grid.Column="0" Text="Custom QS Id" />
        <TextBox Grid.Row="6" Grid.Column="1" Width="200px" Text="{Binding SelectedUser.QuickSupportId, Mode=TwoWay}" />
        <TextBlock Grid.Row="7" Grid.Column="0" Text="Custom QJ Id" />
        <TextBox Grid.Row="7" Grid.Column="1" Width="200px" Text="{Binding SelectedUser.QuickJoinId, Mode=TwoWay}" />
        
        <Button Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" 
                HorizontalAlignment="Left" 
                Width="100px" 
                Content="Get users" 
                Command="{Binding GetUsersCommand, Mode=OneWay}" />
        <Button Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" 
                HorizontalAlignment="Right" 
                Width="120px" 
                Content="Save user changes" 
                Command="{Binding SaveUserCommand, Mode=OneWay}" />
    </Grid>
</UserControl>
