<UserControl x:Class="TeamViewerApi.Views.MeetingsView" 
             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="400" d:DesignWidth="500">
    <UserControl.DataContext>
        <viewModels:MeetingsViewModel />
    </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="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="Meeting" />
        <ComboBox Grid.Row="0" Grid.Column="1" 
                  HorizontalAlignment="Left"
                  Width="200px" 
                  ItemsSource="{Binding Meetings.Items, Mode=OneWay}" 
                  SelectedItem="{Binding SelectedMeeting, Mode=TwoWay}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Style="{x:Null}" Text="{Binding MeetingId, Mode=OneWay}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
        <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 group" />

        <TextBlock Grid.Row="2" Grid.Column="0" Text="Id" />
        <TextBlock Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Text="{Binding SelectedMeeting.MeetingId, Mode=OneWay}" />
        <TextBlock Grid.Row="3" Grid.Column="0" Text="Subject" />
        <TextBox Grid.Row="3" Grid.Column="1" Width="300px" Text="{Binding SelectedMeeting.Subject, Mode=TwoWay}" />
        <TextBlock Grid.Row="4" Grid.Column="0" Text="Start date" />
        <DatePicker Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" Width="150px" SelectedDate="{Binding SelectedMeeting.DateStart, Mode=TwoWay}" />
        <TextBlock Grid.Row="5" Grid.Column="0" Text="End date" />
        <DatePicker Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" Width="150px" SelectedDate="{Binding SelectedMeeting.DateEnd, Mode=TwoWay}" />
        <TextBlock Grid.Row="6" Grid.Column="0" Text="Password" />
        <TextBox Grid.Row="6" Grid.Column="1" Width="200px" Text="{Binding SelectedMeeting.Password, Mode=TwoWay}" />
        <TextBlock Grid.Row="7" Grid.Column="0" Text="Conference type" />
        <ComboBox Grid.Row="7" Grid.Column="1" 
                  HorizontalAlignment="Left" 
                  Width="150px" 
                  ItemsSource="{Binding ConferenceTypes, Mode=OneWay}" 
                  SelectedValue="{Binding SelectedMeeting.ConferenceInformation.Type, Mode=TwoWay}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Style="{x:Null}" Text="{Binding ., Mode=OneWay}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
        <TextBlock Grid.Row="8" Grid.Column="0" Text="Conference data" />
        <TextBox Grid.Row="8" Grid.Column="1" Width="300px" Text="{Binding SelectedMeeting.ConferenceInformation.Data, Mode=TwoWay}" />
        <TextBlock Grid.Row="9" Grid.Column="0" Text="Participant link" />
        <TextBlock Grid.Row="9" Grid.Column="1" HorizontalAlignment="Left">
            <Hyperlink Command="{Binding OpenParticipantLinkCommand, Mode=OneWay}">
                <TextBlock Style="{x:Null}" Text="{Binding SelectedMeeting.Link, Mode=OneWay}" />
            </Hyperlink>
        </TextBlock>

        <DockPanel Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2" LastChildFill="False">
            <Button DockPanel.Dock="Left"
                    Content="Get meetings" 
                    Command="{Binding GetMeetingsCommand, Mode=OneWay}" />
            <Button DockPanel.Dock="Right"
                    Content="Save meeting changes" 
                    Command="{Binding SaveMeetingCommand, Mode=OneWay}" />
        </DockPanel>
        <DockPanel Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="2" LastChildFill="False">
            <Button DockPanel.Dock="Left"
                    Content="Create new meeting" 
                    Command="{Binding CreateMeetingCommand, Mode=OneWay}" />
            <Button DockPanel.Dock="Left"
                    Content="Create new instant meeting" 
                    Command="{Binding CreateInstantMeetingCommand, Mode=OneWay}" />
            <Button DockPanel.Dock="Right" 
                    Content="Delete current meeting" 
                    Command="{Binding DeleteMeetingCommand, Mode=OneWay}" />
        </DockPanel>
    </Grid>
</UserControl>
