<abstract:CreateEmailTemplatePageAbstract
    x:Class="Wino.Views.Settings.CreateEmailTemplatePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:abstract="using:Wino.Views.Abstract"
    xmlns:controls="using:CommunityToolkit.WinUI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:domain="using:Wino.Core.Domain"
    xmlns:helpers="using:Wino.Helpers"
    xmlns:mailControls="using:Wino.Mail.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid RowSpacing="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <controls:SettingsCard
            Grid.Row="0"
            Header="{x:Bind domain:Translator.SettingsEmailTemplates_NameTitle}"
            IsClickEnabled="False">
            <TextBox
                x:Name="TemplateNameTextBox"
                PlaceholderText="{x:Bind domain:Translator.SettingsEmailTemplates_NamePlaceholder}"
                Text="{x:Bind ViewModel.TemplateName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
        </controls:SettingsCard>

        <controls:SettingsCard
            Grid.Row="1"
            Header="{x:Bind domain:Translator.SettingsEmailTemplates_DescriptionTitle}"
            IsClickEnabled="False">
            <TextBox
                AcceptsReturn="True"
                PlaceholderText="{x:Bind domain:Translator.SettingsEmailTemplates_DescriptionPlaceholder}"
                Text="{x:Bind ViewModel.TemplateDescription, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
        </controls:SettingsCard>

        <StackPanel Grid.Row="2" Spacing="8">
            <TextBlock Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" Text="{x:Bind domain:Translator.SettingsEmailTemplates_ContentTitle}" />
            <TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Text="{x:Bind domain:Translator.SettingsEmailTemplates_ContentDescription}" />
            <mailControls:EditorTabbedCommandBarControl CommandTarget="{x:Bind WebViewEditor}" />
            <Border
                MinHeight="420"
                Background="{ThemeResource WinoContentZoneBackgroud}"
                BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
                BorderThickness="1"
                CornerRadius="7">
                <mailControls:WebViewEditorControl x:Name="WebViewEditor" />
            </Border>
        </StackPanel>

        <StackPanel
            Grid.Row="3"
            HorizontalAlignment="Right"
            Orientation="Horizontal"
            Spacing="8">
            <Button
                Click="DeleteClicked"
                Content="{x:Bind domain:Translator.Buttons_Delete}"
                Style="{StaticResource AccentButtonStyle}"
                Visibility="{x:Bind helpers:XamlHelpers.BoolToVisibilityConverter(ViewModel.IsExistingTemplate), Mode=OneWay}" />
            <Button
                Click="SaveClicked"
                Content="{x:Bind domain:Translator.Buttons_Save}"
                Style="{StaticResource AccentButtonStyle}" />
        </StackPanel>
    </Grid>
</abstract:CreateEmailTemplatePageAbstract>
