<ui:UiPage x:Class="Bloxstrap.UI.Elements.Menu.Pages.IntegrationsPage"
      x:Name="IntegrationsPageView"
      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:ui="http://schemas.lepo.co/wpfui/2022/xaml"
      xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels"
      mc:Ignorable="d"
      d:DesignHeight="1080" d:DesignWidth="800"
      Title="IntegrationsPage"
      Scrollable="True">
  <StackPanel Margin="0,0,14,14">
    <TextBlock Text="Configure quick and easy ways to improve the Roblox gameplay experience." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

    <TextBlock Text="Activity tracking" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
    <ui:CardControl Margin="0,8,0,0">
      <ui:CardControl.Header>
        <StackPanel>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" FontSize="14" Text="Enable activity tracking" />
            <TextBlock Grid.Column="1" Margin="4,0,0,0">
              <Hyperlink TextDecorations="None" ToolTip="More information on this integration" Command="models:GlobalViewModel.OpenWebpageCommand" CommandParameter="https://github.com/pizzaboxer/bloxstrap/wiki/What-is-activity-tracking%3F">
                <ui:SymbolIcon Symbol="QuestionCircle48" Margin="0,1,0,0" />
              </Hyperlink>
            </TextBlock>
          </Grid>
          <TextBlock Margin="0,2,0,0" FontSize="12" Text="Allows for Bloxstrap to detect what Roblox game you're playing. Certain features may require this." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
        </StackPanel>
      </ui:CardControl.Header>
      <ui:ToggleSwitch x:Name="ActivityTrackingEnabledToggle" IsChecked="{Binding ActivityTrackingEnabled, Mode=TwoWay}" />
    </ui:CardControl>
    <ui:CardControl Margin="0,8,0,0" IsEnabled="{Binding IsChecked, ElementName=ActivityTrackingEnabledToggle, Mode=OneWay}">
      <ui:CardControl.Header>
        <StackPanel>
          <TextBlock FontSize="14" Text="See server location when joining a game" />
          <TextBlock Margin="0,2,0,0" FontSize="12" Text="When you join a game, you'll be notified of where your server's located. Won't show in fullscreen." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
        </StackPanel>
      </ui:CardControl.Header>
      <ui:ToggleSwitch IsChecked="{Binding ShowServerDetailsEnabled, Mode=TwoWay}" />
    </ui:CardControl>

    <TextBlock Text="Discord Rich Presence" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
    <TextBlock Margin="0,4,0,0" Text="This feature requires activity tracking to be enabled." TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
    <ui:CardControl Margin="0,8,0,0" IsEnabled="{Binding IsChecked, ElementName=ActivityTrackingEnabledToggle, Mode=OneWay}">
      <ui:CardControl.Header>
        <StackPanel>
          <TextBlock FontSize="14" Text="Show game activity" />
          <TextBlock Margin="0,2,0,0" FontSize="12" Text="When playing a Roblox game, the game you're playing will show on your Discord profile activity." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
        </StackPanel>
      </ui:CardControl.Header>
      <ui:ToggleSwitch x:Name="DiscordActivityEnabledToggle" IsChecked="{Binding DiscordActivityEnabled, Mode=TwoWay}" />
    </ui:CardControl>
    <ui:CardControl Margin="0,8,0,0" IsEnabled="{Binding IsChecked, ElementName=DiscordActivityEnabledToggle, Mode=OneWay}">
      <ui:CardControl.Header>
        <StackPanel>
          <TextBlock FontSize="14" Text="Allow activity joining" />
          <TextBlock Margin="0,2,0,0" FontSize="12" Text="Allows for anybody to join the game you're currently in through your Discord profile." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
        </StackPanel>
      </ui:CardControl.Header>
      <ui:ToggleSwitch IsChecked="{Binding DiscordActivityJoinEnabled, Mode=TwoWay}" />
    </ui:CardControl>

    <TextBlock Text="Miscellaneous" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
    <ui:CardControl Margin="0,8,0,0">
      <ui:CardControl.Header>
        <StackPanel>
          <TextBlock FontSize="14" Text="Allow multi-instance launching" />
          <TextBlock Margin="0,2,0,0" FontSize="12" Text="Allows for having more than one Roblox game client instance open simultaneously." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
        </StackPanel>
      </ui:CardControl.Header>
      <ui:ToggleSwitch IsChecked="{Binding MultiInstanceLaunchingEnabled, Mode=TwoWay}" />
    </ui:CardControl>

    <TextBlock Text="Custom Integrations" FontSize="16" FontWeight="Medium" Margin="0,16,0,0" />
    <TextBlock Margin="0,4,0,0" Text="Here, you can have other programs launch with Roblox automatically." TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
    <Grid Margin="0,8,0,0">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="250" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>
      <ListBox x:Name="CustomIntegrationsListBox" Grid.Row="0" Grid.Column="0" Margin="0,0,4,0" ItemsSource="{Binding CustomIntegrations, Mode=OneWay}" DisplayMemberPath="Name" SelectionChanged="CustomIntegrationSelection" SelectedIndex="{Binding SelectedCustomIntegrationIndex, Mode=TwoWay}" />
      <Grid Grid.Row="1" Grid.Column="0" Margin="0,8,4,0">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <ui:Button Grid.Column="0" Margin="0,0,4,0" Icon="Add28" Content="New" HorizontalAlignment="Stretch" Command="{Binding AddIntegrationCommand, Mode=OneTime}" />
        <ui:Button Grid.Column="1" Margin="4,0,0,0" Icon="Delete28" Content="Delete" HorizontalAlignment="Stretch" Appearance="Danger" IsEnabled="{Binding IsCustomIntegrationSelected, Mode=OneWay}" Command="{Binding DeleteIntegrationCommand, Mode=OneTime}" />
      </Grid>
      <StackPanel Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" Margin="4,0,0,0">
        <StackPanel.Style>
          <Style>
            <Style.Triggers>
              <DataTrigger Binding="{Binding IsCustomIntegrationSelected}" Value="False">
                <Setter Property="StackPanel.Visibility" Value="Hidden"></Setter>
              </DataTrigger>
            </Style.Triggers>
          </Style>
        </StackPanel.Style>
        <TextBlock Text="Name" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
        <ui:TextBox Margin="0,4,0,0" Text="{Binding SelectedCustomIntegration.Name}" />
        <TextBlock Margin="0,8,0,0" Text="Application Location" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
        <ui:TextBox Margin="0,4,0,0" PlaceholderText="e.g. C:\Windows\System32\cmd.exe" Text="{Binding SelectedCustomIntegration.Location}" />
        <TextBlock Margin="0,8,0,0" Text="Launch Args" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
        <ui:TextBox Margin="0,4,0,0" PlaceholderText="e.g. /k echo Roblox is running!" Text="{Binding SelectedCustomIntegration.LaunchArgs}" />
        <CheckBox Margin="0,8,0,0" Content="Auto close when Roblox closes" IsChecked="{Binding SelectedCustomIntegration.AutoClose}" />
      </StackPanel>
      <TextBlock Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" Text="No integration selected, please select or add a new one" VerticalAlignment="Center" HorizontalAlignment="Center">
        <TextBlock.Style>
          <Style>
            <Style.Triggers>
              <DataTrigger Binding="{Binding IsCustomIntegrationSelected}" Value="True">
                <Setter Property="TextBlock.Visibility" Value="Hidden"></Setter>
              </DataTrigger>
            </Style.Triggers>
          </Style>
        </TextBlock.Style>
      </TextBlock>
    </Grid>
  </StackPanel>
</ui:UiPage>
