<?xml version="1.0" encoding="UTF-8" ?>
<ContentView
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:pages="clr-namespace:Bit.App.Pages"
    xmlns:u="clr-namespace:Bit.App.Utilities"
    xmlns:controls="clr-namespace:Bit.App.Controls"
    xmlns:effects="clr-namespace:Bit.App.Effects"
    xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
    x:DataType="pages:SendAddEditPageViewModel"
    x:Class="Bit.App.Pages.SendAddOnlyOptionsView">
    <ContentView.Resources>
        <ResourceDictionary>
            <u:InverseBoolConverter x:Key="inverseBool" />
        </ResourceDictionary>
    </ContentView.Resources>
    <ContentView.Content>
        <StackLayout>
            <StackLayout
                StyleClass="box-row"
                Margin="0,10,0,0">
                <Label
                    Text="{u:I18n DeletionDate}"
                    StyleClass="box-label" />
                <Picker
                    x:Name="_deletionDateTypePicker"
                    ItemsSource="{Binding DeletionTypeOptions, Mode=OneTime}"
                    SelectedIndex="{Binding DeletionDateTypeSelectedIndex}"
                    IsEnabled="{Binding SendEnabled}"
                    StyleClass="box-value"
                    ItemDisplayBinding="{Binding Key}"
                    ios:Picker.UpdateMode="WhenFinished"
                    AutomationProperties.IsInAccessibleTree="True"
                    AutomationProperties.Name="{u:I18n DeletionTime}" />
                <controls:LazyDateTimePicker
                    x:Name="_lazyDeletionDateTimePicker"
                    BindingContext="{Binding DeletionDateTimeViewModel}"
                    IsVisible="{Binding ShowDeletionCustomPickers}"
                    Margin="0,5,0,0" />
                <Label
                    Text="{u:I18n DeletionDateInfo}"
                    StyleClass="box-footer-label"
                    Margin="0,5,0,0" />
            </StackLayout>
            <StackLayout StyleClass="box-row" Margin="0,5,0,0">
                <Label
                    Text="{u:I18n ExpirationDate}"
                    StyleClass="box-label" />
                <Picker
                    x:Name="_expirationDateTypePicker"
                    ItemsSource="{Binding ExpirationTypeOptions, Mode=OneTime}"
                    SelectedIndex="{Binding ExpirationDateTypeSelectedIndex}"
                    ItemDisplayBinding="{Binding Key}"
                    ios:Picker.UpdateMode="WhenFinished"
                    IsEnabled="{Binding SendEnabled}"
                    StyleClass="box-value"
                    AutomationProperties.IsInAccessibleTree="True"
                    AutomationProperties.Name="{u:I18n ExpirationTime}" />
                <controls:LazyDateTimePicker
                    x:Name="_lazyExpirationDateTimePicker"
                    BindingContext="{Binding ExpirationDateTimeViewModel}"
                    IsVisible="{Binding ShowExpirationCustomPickers}"
                    Margin="0,5,0,0" />
                <Label
                    Text="{u:I18n ExpirationDateInfo}"
                    StyleClass="box-footer-label"
                    HorizontalOptions="StartAndExpand"
                    Margin="0,5,0,0" />
            </StackLayout>
            <StackLayout
                StyleClass="box-row"
                Margin="0,5,0,0">
                <Label
                    Text="{u:I18n MaximumAccessCount}"
                    StyleClass="box-label" />
                <StackLayout
                    StyleClass="box-row"
                    Orientation="Horizontal">
                    <Entry
                        Text="{Binding MaxAccessCount}"
                        IsEnabled="{Binding SendEnabled}"
                        StyleClass="box-value"
                        Keyboard="Numeric"
                        MaxLength="9"
                        TextChanged="OnMaxAccessCountTextChanged"
                        HorizontalOptions="FillAndExpand" />
                    <controls:ExtendedStepper
                        x:Name="_maxAccessCountStepper"
                        Value="{Binding MaxAccessCount}"
                        Maximum="999999999"
                        IsEnabled="{Binding SendEnabled}"
                        Margin="10,0,0,0" />
                </StackLayout>
                <Label
                    Text="{u:I18n MaximumAccessCountInfo}"
                    StyleClass="box-footer-label" />
            </StackLayout>
            <StackLayout
                StyleClass="box-row"
                Margin="0,5,0,0">
                <Label
                    Text="{u:I18n NewPassword}"
                    StyleClass="box-label" />
                <StackLayout Orientation="Horizontal">
                    <Entry
                        Text="{Binding NewPassword}"
                        IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
                        IsEnabled="{Binding SendEnabled}"
                        StyleClass="box-value"
                        IsSpellCheckEnabled="False"
                        IsTextPredictionEnabled="False"
                        HorizontalOptions="FillAndExpand" />
                    <controls:IconButton
                        IsEnabled="{Binding SendEnabled}"
                        StyleClass="box-row-button, box-row-button-platform"
                        Text="{Binding ShowPasswordIcon}"
                        Command="{Binding TogglePasswordCommand}"
                        Margin="10,0,0,0"
                        AutomationProperties.IsInAccessibleTree="True"
                        AutomationProperties.Name="{u:I18n ToggleVisibility}"
                        AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" />
                </StackLayout>
                <Label
                    Text="{u:I18n PasswordInfo}"
                    StyleClass="box-footer-label"
                    Margin="0,5,0,0" />
            </StackLayout>
            <StackLayout
                StyleClass="box-row"
                Margin="0,5,0,0">
                <Label
                    Text="{u:I18n Notes}"
                    StyleClass="box-label" />
                <Editor
                    x:Name="_notesEditor"
                    AutoSize="TextChanges"
                    Text="{Binding Send.Notes}"
                    IsEnabled="{Binding SendEnabled}"
                    StyleClass="box-value"
                    Margin="0,10,0,5"
                    effects:ScrollEnabledEffect.IsScrollEnabled="false" >
                    <Editor.Effects>
                        <effects:ScrollEnabledEffect />
                    </Editor.Effects>
                </Editor>
                <BoxView
                    StyleClass="box-row-separator" />
                <Label
                    Text="{u:I18n NotesInfo}"
                    StyleClass="box-footer-label"
                    Margin="0,5,0,0" />
            </StackLayout>
            <StackLayout
                StyleClass="box-row, box-row-switch"
                Margin="0,5,0,0">
                <Label
                    Text="{u:I18n HideEmail}"
                    StyleClass="box-label-regular"
                    VerticalOptions="Center"
                    HorizontalOptions="StartAndExpand" />
                <Switch
                    IsToggled="{Binding Send.HideEmail}"
                    IsEnabled="{Binding DisableHideEmailControl, Converter={StaticResource inverseBool}}"
                    HorizontalOptions="End"
                    Margin="10,0,0,0" />
            </StackLayout>
            <StackLayout
                StyleClass="box-row, box-row-switch"
                Margin="0,5,0,0">
                <Label
                    Text="{u:I18n DisableSend}"
                    StyleClass="box-label-regular"
                    VerticalOptions="Center"
                    HorizontalOptions="StartAndExpand" />
                <Switch
                    IsToggled="{Binding Send.Disabled}"
                    IsEnabled="{Binding SendEnabled}"
                    HorizontalOptions="End"
                    Margin="10,0,0,0" />
            </StackLayout>
        </StackLayout>
    </ContentView.Content>
</ContentView>
