<?xml version="1.0" encoding="UTF-8" ?>
<pages:BaseContentPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Bit.App.Pages.Accounts.VerificationCodePage"
    xmlns:pages="clr-namespace:Bit.App.Pages"
    xmlns:u="clr-namespace:Bit.App.Utilities"
    xmlns:controls="clr-namespace:Bit.App.Controls"
    x:DataType="pages:VerificationCodeViewModel"
    Title="{Binding PageTitle}">
    <ContentPage.BindingContext>
        <pages:VerificationCodeViewModel />
    </ContentPage.BindingContext>

    <ContentPage.ToolbarItems>
        <ToolbarItem Text="{u:I18n Close}" Clicked="Close_Clicked" Order="Primary" Priority="-1" />
    </ContentPage.ToolbarItems>

    <ContentPage.Resources>
        <u:InverseBoolConverter x:Key="inverseBool" />
        <Style TargetType="Label" x:Key="lblDescription">
           <Setter Property="FontSize" Value="{OnPlatform Android=Large, iOS=Small}" />
        </Style>
    </ContentPage.Resources>

    <ContentPage.Content>
        <ScrollView>
            <Grid
                RowSpacing="10"
                ColumnSpacing="10"
                RowDefinitions="Auto, Auto, Auto"
                ColumnDefinitions="*, *"
                Padding="10">
                <Label
                    Grid.Row="0"
                    Grid.ColumnSpan="2"
                    Padding="0,10"
                    Text="{Binding SendCodeStatus}"
                    StyleClass="box-label"
                    LineBreakMode="WordWrap"
                    Margin="0,0,0,10" />
                <Grid
                    StyleClass="box-row"
                    Grid.Row="1"
                    Grid.ColumnSpan="2"
                    RowDefinitions="Auto,Auto,Auto"
                    ColumnDefinitions="*,Auto"
                    Padding="0">
                    <Label
                        Text="{u:I18n VerificationCode}"
                        StyleClass="box-label"
                        Grid.Row="0"
                        Grid.ColumnSpan="2" />
                    <controls:MonoEntry
                        x:Name="_secret"
                        Text="{Binding Secret}"
                        StyleClass="box-value"
                        IsSpellCheckEnabled="False"
                        IsTextPredictionEnabled="False"
                        IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
                        Grid.Row="1"
                        Grid.Column="0"
                        ReturnType="Go"
                        ReturnCommand="{Binding MainActionCommand}" />
                    <controls:IconButton
                        StyleClass="box-row-button, box-row-button-platform"
                        Text="{Binding ShowPasswordIcon}"
                        Command="{Binding TogglePasswordCommand}"
                        Grid.Row="1"
                        Grid.Column="1"
                        AutomationProperties.IsInAccessibleTree="True"
                        AutomationProperties.Name="{u:I18n ToggleVisibility}"/>
                    <Label
                        Text="{u:I18n ConfirmYourIdentity}"
                        StyleClass="box-footer-label"
                        LineBreakMode="WordWrap"
                        Grid.Row="2"
                        Margin="0,10,0,0" />
                </Grid>
                <Button
                    x:Name="_mainActionButton"
                    Grid.Row="2"
                    Padding="10,0"
                    Text="{Binding MainActionText}"
                    Command="{Binding MainActionCommand}"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="Start" />
                <Button
                    Grid.Row="2"
                    Grid.Column="1"
                    Text="{u:I18n ResendCode}"
                    Padding="10,0"
                    Command="{Binding RequestOTPCommand}"
                    HorizontalOptions="Fill"
                    VerticalOptions="Start"/>
            </Grid>
        </ScrollView>
    </ContentPage.Content>
</pages:BaseContentPage>
