<?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.AutofillServicesPage"
    xmlns:pages="clr-namespace:Bit.App.Pages"
    xmlns:u="clr-namespace:Bit.App.Utilities"
    x:DataType="pages:AutofillServicesPageViewModel"
    Title="{Binding PageTitle}">
    <ContentPage.BindingContext>
        <pages:AutofillServicesPageViewModel />
    </ContentPage.BindingContext>

    <ScrollView>
        <StackLayout Padding="0" Spacing="20">
            <StackLayout 
                StyleClass="box"
                IsVisible="{Binding AutofillServiceVisible}">
                <StackLayout StyleClass="box-row, box-row-switch">
                    <Label
                        Text="{u:I18n AutofillService}"
                        StyleClass="box-label-regular"
                        HorizontalOptions="StartAndExpand" />
                    <RelativeLayout HorizontalOptions="End">
                        <Switch
                            x:Name="AutofillServiceSwitch"
                            IsToggled="{Binding AutofillServiceToggled}"
                            StyleClass="box-value"
                            HorizontalOptions="End" />
                        <Button
                            Clicked="ToggleAutofillService"
                            StyleClass="box-overlay"
                            RelativeLayout.XConstraint="0"
                            RelativeLayout.YConstraint="0"
                            RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=AutofillServiceSwitch, Property=Width}"
                            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=AutofillServiceSwitch, Property=Height}" />
                    </RelativeLayout>
                </StackLayout>
                <Label
                    Text="{u:I18n AutofillServiceDescription}"
                    StyleClass="box-footer-label, box-footer-label-switch" />
            </StackLayout>
            <StackLayout 
                StyleClass="box"
                IsVisible="{Binding InlineAutofillVisible}">
                <StackLayout StyleClass="box-row, box-row-switch">
                    <Label
                        Text="{u:I18n InlineAutofill}"
                        StyleClass="box-label-regular"
                        IsEnabled="{Binding InlineAutofillEnabled}"
                        HorizontalOptions="StartAndExpand" />
                    <RelativeLayout HorizontalOptions="End">
                        <Switch
                            x:Name="InlineAutofillSwitch"
                            IsEnabled="{Binding InlineAutofillEnabled}"
                            IsToggled="{Binding InlineAutofillToggled}"
                            StyleClass="box-value"
                            HorizontalOptions="End" />
                        <Button
                            Clicked="ToggleInlineAutofill"
                            StyleClass="box-overlay"
                            RelativeLayout.XConstraint="0"
                            RelativeLayout.YConstraint="0"
                            RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=InlineAutofillSwitch, Property=Width}"
                            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=InlineAutofillSwitch, Property=Height}" />
                    </RelativeLayout>
                </StackLayout>
                <Label
                    Text="{u:I18n InlineAutofillDescription}"
                    StyleClass="box-footer-label, box-footer-label-switch"
                    IsEnabled="{Binding InlineAutofillEnabled}"/>
            </StackLayout>
            <StackLayout StyleClass="box">
                <StackLayout StyleClass="box-row, box-row-switch">
                    <Label
                        Text="{u:I18n Accessibility}"
                        StyleClass="box-label-regular"
                        HorizontalOptions="StartAndExpand" />
                    <RelativeLayout HorizontalOptions="End">
                        <Switch
                            x:Name="AccessibilitySwitch"
                            IsToggled="{Binding AccessibilityToggled}"
                            StyleClass="box-value"
                            HorizontalOptions="End" />
                        <Button
                            Command="{Binding ToggleAccessibilityCommand}"
                            StyleClass="box-overlay"
                            RelativeLayout.XConstraint="0"
                            RelativeLayout.YConstraint="0"
                            RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=AccessibilitySwitch, Property=Width}"
                            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=AccessibilitySwitch, Property=Height}" />
                    </RelativeLayout>
                </StackLayout>
                <Label
                    Text="{Binding AccessibilityDescriptionLabel}"
                    StyleClass="box-footer-label, box-footer-label-switch" />
            </StackLayout>
            <StackLayout 
                StyleClass="box"
                IsVisible="{Binding DrawOverVisible}">
                <StackLayout StyleClass="box-row, box-row-switch">
                    <Label
                        Text="{u:I18n DrawOver}"
                        StyleClass="box-label-regular"
                        IsEnabled="{Binding DrawOverEnabled}"
                        HorizontalOptions="StartAndExpand" />
                    <RelativeLayout HorizontalOptions="End">
                        <Switch
                            x:Name="DrawOverSwitch"
                            IsEnabled="{Binding DrawOverEnabled}"
                            IsToggled="{Binding DrawOverToggled}"
                            StyleClass="box-value"
                            HorizontalOptions="End" />
                        <Button
                            Clicked="ToggleDrawOver"
                            StyleClass="box-overlay"
                            RelativeLayout.XConstraint="0"
                            RelativeLayout.YConstraint="0"
                            RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=DrawOverSwitch, Property=Width}"
                            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=DrawOverSwitch, Property=Height}" />
                    </RelativeLayout>
                </StackLayout>
                <Label
                    Text="{Binding DrawOverDescriptionLabel}"
                    StyleClass="box-footer-label, box-footer-label-switch"
                    IsEnabled="{Binding InlineAutofillEnabled}"/>
            </StackLayout>
        </StackLayout>
    </ScrollView>

</pages:BaseContentPage>
