<Window x:Class="ytLive.GoLiveWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Start Stream" Height="480" Width="520"
        Icon="/Assets/llama-logo-icon.png"
        WindowStartupLocation="CenterOwner" ResizeMode="NoResize"
        ShowInTaskbar="False" Background="#1a1a2e">

    <Window.Resources>
        <ResourceDictionary>
            <BooleanToVisibilityConverter x:Key="BoolToVis"/>
        </ResourceDictionary>
    </Window.Resources>

    <Grid Margin="24">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" Text="Start Stream" FontSize="18" FontWeight="Bold"
                   Foreground="#e0e0e0" Margin="0,0,0,16"/>

        <!-- ACCOUNT -->
        <StackPanel Grid.Row="1" Margin="0,0,0,16">
            <TextBlock Text="ACCOUNT" FontSize="12" FontWeight="SemiBold"
                       Foreground="#a0a0b0" Margin="0,0,0,8"/>

            <!-- signed in -->
            <StackPanel Orientation="Horizontal">
                <StackPanel.Style>
                    <Style TargetType="StackPanel">
                        <Setter Property="Visibility" Value="Collapsed"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsSignedIn}" Value="True">
                                <Setter Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </StackPanel.Style>
                <Border Width="34" Height="34" CornerRadius="17" Background="#16213e" ClipToBounds="True"
                        VerticalAlignment="Center" Margin="0,0,10,0">
                    <Image Source="{Binding AccountAvatarUrl}" Stretch="UniformToFill"/>
                </Border>
                <TextBlock Text="{Binding AccountDisplayName}" Foreground="#e0e0e0" FontSize="14"
                           VerticalAlignment="Center" Margin="0,0,12,0"/>
                <Button Content="Change Account" Command="{Binding SignInCommand}"
                        Style="{StaticResource YtButtonSecondary}" VerticalAlignment="Center"/>
            </StackPanel>

            <!-- signed out -->
            <StackPanel Orientation="Horizontal">
                <StackPanel.Style>
                    <Style TargetType="StackPanel">
                        <Setter Property="Visibility" Value="Visible"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsSignedIn}" Value="True">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </StackPanel.Style>
                <Button Content="Sign in to YouTube" Command="{Binding SignInCommand}"
                        Style="{StaticResource YtButtonSecondary}" Margin="0,0,10,0"/>
                <TextBlock Text="Going live requires a YouTube account." Foreground="#a0a0b0" FontSize="12"
                           VerticalAlignment="Center"/>
            </StackPanel>

            <TextBlock Text="Signing in… open the browser to authorize, then come back here."
                       Foreground="#e94560" FontSize="12" Margin="0,8,0,0">
                <TextBlock.Style>
                    <Style TargetType="TextBlock">
                        <Setter Property="Visibility" Value="Collapsed"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsBusy}" Value="True">
                                <Setter Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </TextBlock.Style>
            </TextBlock>
        </StackPanel>

        <!-- STREAM METADATA -->
        <StackPanel Grid.Row="2">
            <TextBlock Text="STREAM DETAILS" FontSize="12" FontWeight="SemiBold"
                       Foreground="#a0a0b0" Margin="0,0,0,8"/>

            <TextBlock Text="Title" Style="{StaticResource YtLabel}"/>
            <TextBox Style="{StaticResource YtTextBox}" Margin="0,0,0,12"
                     Text="{Binding StreamTitle, UpdateSourceTrigger=PropertyChanged}"/>

            <TextBlock Text="Description" Style="{StaticResource YtLabel}"/>
            <TextBox Style="{StaticResource YtTextBox}" Height="60" AcceptsReturn="True" Margin="0,0,0,12"
                     Text="{Binding StreamDescription, UpdateSourceTrigger=PropertyChanged}"
                     VerticalScrollBarVisibility="Auto"/>

            <TextBlock Text="Visibility" Style="{StaticResource YtLabel}"/>
            <StackPanel Orientation="Horizontal" Margin="0,0,0,12">
                <TextBlock Text="Private" Foreground="#e0e0e0" FontSize="14"
                           VerticalAlignment="Center"/>
                <TextBlock Text="Streams always start Private — change it on YouTube after going live."
                           Foreground="#a0a0b0" FontSize="12" TextWrapping="Wrap"
                           Margin="10,0,0,0" VerticalAlignment="Center"/>
            </StackPanel>
        </StackPanel>

        <!-- ACTIONS -->
        <StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Cancel" Command="{Binding CancelCommand}"
                    Style="{StaticResource YtButtonSecondary}" Margin="0,0,8,0"/>
            <Button Content="Start Stream" Command="{Binding StartCommand}"
                    Style="{StaticResource YtButton}" MinWidth="110"/>
        </StackPanel>
    </Grid>
</Window>
