<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="CanYouBuildIt.Views.SignIn"
             Title="SignIn"
             BackgroundColor="#26B4BE">
    <AbsoluteLayout>

        <VerticalStackLayout
                AbsoluteLayout.LayoutBounds="0.5,0.5,500,700"
                AbsoluteLayout.LayoutFlags="PositionProportional"
                BackgroundColor="#408097">
            
            <Image Source="logologin.png"
                   Margin="25,60,25,0"/>

            <Label Text="Inscription"
                   FontAttributes="Bold"
                   FontSize="30"
                   Margin="25,60,25,0"
                   MaximumWidthRequest="160"
                   TextColor="White"
                   WidthRequest="500"/>


            <Entry  BackgroundColor="#EEEEFF"
                    HeightRequest="20"
                    Margin="25,60,25,0"
                    Placeholder="Nom"
                    PlaceholderColor="Black"
                    TextColor="Black"
                    x:Name="Nom"/>

            <Entry  BackgroundColor="#EEEEFF"
                    HeightRequest="20"
                    IsPassword="True"
                    Margin="25,60,25,0"
                    Placeholder="Mot de Passe"
                    PlaceholderColor="Black"
                    TextColor="Black" 
                    x:Name="Mdp"/>

            <Entry  BackgroundColor="#EEEEFF"
                    HeightRequest="20"
                    IsPassword="True"
                    Margin="25,60,25,0"
                    Placeholder="Confirmer Mot de Passe"
                    PlaceholderColor="Black"
                    TextColor="Black"
                    x:Name="cMdp"/>
            <VerticalStackLayout>

                <Button BackgroundColor="DimGrey"
                        Clicked="BtValider"
                        FontAttributes="Bold"
                        HorizontalOptions="Center"
                        Margin="0,25"
                        Text="Valider"
                        TextColor="White"
                        x:Name="btnValider" />

                <Button BackgroundColor="DimGrey"
                        Margin="0,60"
                        x:Name="annul"
                        Text="Annuler"
                        FontAttributes="Bold"
                        TextColor="White"
                        Clicked="BackLogin"
                        HorizontalOptions="Center" />

                <Label Text="WARNING ! Les champs doivent être remplis."
                       IsVisible="false"
                       x:Name="vide"
                       BackgroundColor="Red"
                       FontAttributes="Bold"
                       Padding="30"
                       Margin="0,30,0,0"
                       HorizontalOptions="Center"
                       WidthRequest="500"/>
                
<!-- the cat : fcgvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv-->
                <Label Text="Le mot de passe doit être composé d'au moins 4 caractères."
                       IsVisible="false"
                       x:Name="wrong"
                       BackgroundColor="Red"
                       FontAttributes="Bold"
                       Padding="30"
                       Margin="0,30,0,0"
                       HorizontalOptions="Center"
                       WidthRequest="500"/>

                <Label Text="Les 2 mots de passe doivent être les mêmes."
                       BackgroundColor="Red"
                       FontAttributes="Bold"
                       HorizontalOptions="Center"
                       IsVisible="false"
                       Margin="0,30,0,0"
                       Padding="30"
                       WidthRequest="500"
                       x:Name="nequal"/>
                
                <Label Text="Ce nom n'est pas disponible."
                       BackgroundColor="Red"
                       FontAttributes="Bold"
                       HorizontalOptions="Center"
                       IsVisible="false"
                       Margin="0,30,0,0"
                       Padding="30"
                       WidthRequest="500"
                       x:Name="userNameUsed"/>

                <Label Text="Incription valide."
                       IsVisible="false"
                       x:Name="valide"
                       BackgroundColor="Green"
                       FontAttributes="Bold"
                       Padding="30"
                       Margin="0,30,0,0"
                       HorizontalOptions="Center"
                       WidthRequest="500"/>
            </VerticalStackLayout>
        </VerticalStackLayout>
    </AbsoluteLayout>
</ContentPage>